From 0e1974dc038c425ca2e5eea9f680e67cbb6cb848 Mon Sep 17 00:00:00 2001 From: ste Date: Tue, 11 Feb 2020 11:46:11 +0000 Subject: [PATCH] GPII-4343: Saving the default theme if the current theme is unknown. --- .../spiSettingsHandler/src/SpiSettingsHandler.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/gpii/node_modules/spiSettingsHandler/src/SpiSettingsHandler.js b/gpii/node_modules/spiSettingsHandler/src/SpiSettingsHandler.js index 4739e6409..3d9ee4018 100644 --- a/gpii/node_modules/spiSettingsHandler/src/SpiSettingsHandler.js +++ b/gpii/node_modules/spiSettingsHandler/src/SpiSettingsHandler.js @@ -518,7 +518,7 @@ gpii.windows.spi.GPII1873_HighContrastBug = function (method, payload, results) * @return {String} The display name of the theme specified in the .theme file. */ gpii.windows.spiSettingsHandler.setHighContrastTheme = function (newThemeFile, currentThemeFile, saveAs, dryRun) { - if (currentThemeFile && saveAs) { + if (saveAs) { gpii.windows.spiSettingsHandler.saveTheme(currentThemeFile, saveAs); } @@ -566,15 +566,15 @@ gpii.windows.spiSettingsHandler.setHighContrastTheme = function (newThemeFile, c * @param {String} saveAs The temporary .theme file to which the current theme is saved. */ gpii.windows.spiSettingsHandler.saveTheme = function (currentThemeFile, saveAs) { - var themeData = gpii.iniFile.readFile(currentThemeFile); + var themeData = currentThemeFile && gpii.iniFile.readFile(currentThemeFile); fluid.log("Saving theme from " + currentThemeFile); - var isValid = !!(themeData.MasterThemeSelector && themeData.MasterThemeSelector.MTSM); + var isValid = themeData && !!(themeData.MasterThemeSelector && themeData.MasterThemeSelector.MTSM); if (!isValid) { fluid.log("Theme file invalid."); // If the theme file isn't valid, load the default one. var defaultTheme = path.join(process.env.SystemRoot, "resources/Themes/aero.theme"); if (currentThemeFile !== defaultTheme) { - gpii.windows.spiSettingsHandler.saveTheme(defaultTheme); + gpii.windows.spiSettingsHandler.saveTheme(defaultTheme, saveAs); } } else if (!themeData.VisualStyles || !themeData.VisualStyles.HighContrast) { // Only save the current theme if it is not high-contrast. Otherwise, when changing the high-contrast theme