Skip to content

Commit 6426862

Browse files
committed
Fixed Rider warnings
1 parent 243607b commit 6426862

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

src/Sidekick.Common/Settings/SettingsService.cs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public async Task<bool> GetBool(string key)
4242
var defaultProperty = typeof(DefaultSettings).GetProperty(key);
4343
if (defaultProperty == null)
4444
{
45-
return default;
45+
return false;
4646
}
4747

4848
return (bool)(defaultProperty.GetValue(null) ?? false);
@@ -62,7 +62,7 @@ public async Task<bool> GetBool(string key)
6262
var defaultProperty = typeof(DefaultSettings).GetProperty(key);
6363
if (defaultProperty == null)
6464
{
65-
return default;
65+
return null;
6666
}
6767

6868
return (string?)(defaultProperty.GetValue(null) ?? null);
@@ -82,7 +82,7 @@ public async Task<int> GetInt(string key)
8282
var defaultProperty = typeof(DefaultSettings).GetProperty(key);
8383
if (defaultProperty == null)
8484
{
85-
return default;
85+
return 0;
8686
}
8787

8888
return (int)(defaultProperty.GetValue(null) ?? 0);
@@ -102,7 +102,7 @@ public async Task<int> GetInt(string key)
102102
var defaultProperty = typeof(DefaultSettings).GetProperty(key);
103103
if (defaultProperty == null)
104104
{
105-
return default;
105+
return null;
106106
}
107107

108108
return (DateTimeOffset?)(defaultProperty.GetValue(null) ?? null);
@@ -164,7 +164,7 @@ public async Task<int> GetInt(string key)
164164
var defaultProperty = typeof(DefaultSettings).GetProperty(key);
165165
if (defaultProperty == null)
166166
{
167-
return default;
167+
return null;
168168
}
169169

170170
try
@@ -187,7 +187,7 @@ public async Task<int> GetInt(string key)
187187
throw;
188188
}
189189

190-
return default;
190+
return null;
191191
}
192192

193193
public async Task Set(
@@ -243,7 +243,7 @@ public async Task Set(
243243

244244
public async Task<bool> IsSettingModified(params string[] keys)
245245
{
246-
if (keys == null || keys.Length == 0)
246+
if (keys.Length == 0)
247247
{
248248
return false;
249249
}
@@ -280,13 +280,13 @@ public async Task<bool> IsSettingModified(params string[] keys)
280280

281281
public async Task DeleteSetting(params string[] keys)
282282
{
283-
if (keys == null || keys.Length == 0)
283+
if (keys.Length == 0)
284284
{
285285
return;
286286
}
287287

288288
await using var dbContext = new SidekickDbContext(dbContextOptions);
289-
bool changed = false;
289+
var changed = false;
290290

291291
var dbSettings = await dbContext.Settings.Where(x => keys.Contains(x.Key)).ToListAsync();
292292

0 commit comments

Comments
 (0)