mirror of
https://github.com/Foundry376/Mailspring.git
synced 2025-02-22 23:23:54 +08:00
Sentry fix: “Cannot read property 'split' of undefined” in linux theme resolution
This commit is contained in:
parent
1547234040
commit
88dc7bb6b9
1 changed files with 15 additions and 13 deletions
|
@ -244,25 +244,27 @@ function getIconFromTheme(
|
|||
*/
|
||||
function getIconPath(iconName: string, size: number, context: string | string[], scale: 1 | 2 = 1) {
|
||||
let defaultTheme = getIconTheme(getIconThemeName());
|
||||
if (defaultTheme != null) {
|
||||
let inherits = defaultTheme.data['Icon Theme']['Inherits'].split(',');
|
||||
if (!defaultTheme) return null;
|
||||
|
||||
let icon = getIconFromTheme(defaultTheme, iconName, size, context, scale);
|
||||
const iconThemeObject = defaultTheme.data['Icon Theme'];
|
||||
const inheritsList = iconThemeObject && iconThemeObject['Inherits'];
|
||||
if (!inheritsList) return null;
|
||||
|
||||
const inherits = inheritsList.split(',');
|
||||
let icon = getIconFromTheme(defaultTheme, iconName, size, context, scale);
|
||||
|
||||
if (icon !== null) {
|
||||
return icon;
|
||||
}
|
||||
|
||||
// in case the icon was not found in the theme, we search the inherited themes
|
||||
for (let key of inherits) {
|
||||
let inheritsTheme = getIconTheme(inherits[key]);
|
||||
icon = getIconFromTheme(inheritsTheme, iconName, size, context);
|
||||
if (icon !== null) {
|
||||
return icon;
|
||||
}
|
||||
|
||||
// in case the icon was not found in the theme, we search the inherited themes
|
||||
for (let key of inherits) {
|
||||
let inheritsTheme = getIconTheme(inherits[key]);
|
||||
icon = getIconFromTheme(inheritsTheme, iconName, size, context);
|
||||
if (icon !== null) {
|
||||
return icon;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue