[Settings][New+]Crash when running Dev build of Settings (#35066)

This commit is contained in:
Ani 2024-09-25 18:44:14 +02:00 committed by GitHub
parent 471db8bf9c
commit 13c9ba9f81
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -207,6 +207,12 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
try
{
settings = settingsUtils.GetSettingsOrDefault<NewPlusSettings>(NewPlusSettings.ModuleName);
if (string.IsNullOrEmpty(settings.TemplateLocation))
{
// This can happen when running the DEBUG Settings application without first letting the runner create the default settings file.
settings.TemplateLocation = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "Microsoft", "PowerToys", "NewPlus", "Templates");
}
}
catch (Exception e)
{