diff options
| author | Oskar Nyberg <oskar@mullvad.net> | 2022-09-30 13:16:14 +0200 |
|---|---|---|
| committer | Oskar Nyberg <oskar@mullvad.net> | 2022-09-30 16:13:55 +0200 |
| commit | 46a939d6fdf25887e9eeac1ee3345725030caa9e (patch) | |
| tree | 3be6d9fc7f3e80f93be84fb8712600f1dbae4f38 /gui/src | |
| parent | fff4651f823c79a09b9f2883013561f777389180 (diff) | |
| download | mullvadvpn-46a939d6fdf25887e9eeac1ee3345725030caa9e.tar.xz mullvadvpn-46a939d6fdf25887e9eeac1ee3345725030caa9e.zip | |
Fix app crashing when trying to set svg to window icon
Diffstat (limited to 'gui/src')
| -rw-r--r-- | gui/src/main/index.ts | 11 | ||||
| -rw-r--r-- | gui/src/main/linux-desktop-entry.ts | 8 |
2 files changed, 13 insertions, 6 deletions
diff --git a/gui/src/main/index.ts b/gui/src/main/index.ts index ef6fdc894b..9a396d4307 100644 --- a/gui/src/main/index.ts +++ b/gui/src/main/index.ts @@ -422,9 +422,14 @@ class ApplicationMain } if (process.platform === 'linux') { - const icon = await findIconPath('mullvad-vpn'); - if (icon) { - this.userInterface.setWindowIcon(icon); + try { + const icon = await findIconPath('mullvad-vpn', ['png']); + if (icon) { + this.userInterface.setWindowIcon(icon); + } + } catch (e) { + const error = e as Error; + log.error('Failed to set window icon:', error.message); } } diff --git a/gui/src/main/linux-desktop-entry.ts b/gui/src/main/linux-desktop-entry.ts index 23b2756f23..acac772ce5 100644 --- a/gui/src/main/linux-desktop-entry.ts +++ b/gui/src/main/linux-desktop-entry.ts @@ -219,10 +219,12 @@ export async function getImageDataUrl(imagePath: string): Promise<string> { } // Returns the path of the icon with the specified name. If none is found it returns undefined. -export async function findIconPath(name: string): Promise<string | undefined> { +export async function findIconPath( + name: string, + allowedExtensions = ['svg', 'png'], +): Promise<string | undefined> { // Chromium doesn't support .xpm files - const extensions = ['svg', 'png']; - return findIcon(name, extensions, [ + return findIcon(name, allowedExtensions, [ getIconDirectories(), await getGtkThemeDirectories(), // Begin with preferred sized but if nothing matches other sizes should be considered as well. |
