We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent c28044a commit 3100f60Copy full SHA for 3100f60
src/Files.App/Utils/Serialization/Implementation/DefaultJsonSettingsDatabase.cs
@@ -2,6 +2,7 @@
2
// Licensed under the MIT License.
3
4
using System.Collections.Concurrent;
5
+using System.Text.Json;
6
7
namespace Files.App.Utils.Serialization.Implementation
8
{
@@ -118,7 +119,16 @@ public virtual bool ImportSettings(object? import)
118
119
120
if (obj is JsonElement jElem)
121
- return jElem.Deserialize<TValue>();
122
+ try
123
+ {
124
+ return jElem.Deserialize<TValue>();
125
+ }
126
+ catch (JsonException)
127
128
+ // Deserialization failed (e.g., incompatible type in settings file)
129
+ // Return null to fall back to the default value
130
+ return default;
131
132
}
133
134
return (TValue?)obj;
0 commit comments