mirror of
https://github.com/captbaritone/webamp.git
synced 2026-07-21 00:59:29 +00:00
Handle case where EQ images are missing
This commit is contained in:
parent
51f548faea
commit
2e83920ca1
2 changed files with 15 additions and 8 deletions
|
|
@ -49,11 +49,12 @@ class EqGraph extends React.Component {
|
|||
}
|
||||
|
||||
async createColorPattern(lineColorsImagePromise) {
|
||||
const lineColorsImage = await lineColorsImagePromise;
|
||||
if (lineColorsImage == null) {
|
||||
return;
|
||||
}
|
||||
this.setState({
|
||||
colorPattern: this.canvasCtx.createPattern(
|
||||
await lineColorsImagePromise,
|
||||
"repeat-x"
|
||||
),
|
||||
colorPattern: this.canvasCtx.createPattern(lineColorsImage, "repeat-x"),
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -721,24 +721,30 @@ export function getRandomizePresets(state: AppState): boolean {
|
|||
return state.milkdrop.randomize;
|
||||
}
|
||||
|
||||
export function getPreampLineUrl(state: AppState): string {
|
||||
export function getPreampLineUrl(state: AppState): string | null {
|
||||
return state.display.skinImages.EQ_PREAMP_LINE;
|
||||
}
|
||||
|
||||
export function getLineColorsUrl(state: AppState): string {
|
||||
export function getLineColorsUrl(state: AppState): string | null {
|
||||
return state.display.skinImages.EQ_GRAPH_LINE_COLORS;
|
||||
}
|
||||
|
||||
export const getPreampLineImage = createSelector(
|
||||
getPreampLineUrl,
|
||||
async (url): Promise<HTMLImageElement> => {
|
||||
async (url): Promise<HTMLImageElement | null> => {
|
||||
if (url == null) {
|
||||
return null;
|
||||
}
|
||||
return Utils.imgFromUrl(url);
|
||||
}
|
||||
);
|
||||
|
||||
export const getLineColorsImage = createSelector(
|
||||
getLineColorsUrl,
|
||||
async (url): Promise<HTMLImageElement> => {
|
||||
async (url): Promise<HTMLImageElement | null> => {
|
||||
if (url == null) {
|
||||
return null;
|
||||
}
|
||||
return Utils.imgFromUrl(url);
|
||||
}
|
||||
);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue