reove null warnings
This commit is contained in:
parent
bbd11ec870
commit
a277aaeb93
@ -25,10 +25,12 @@ var name = Console.ReadLine() ?? "";
|
||||
|
||||
var hs = new HighScore { Name = name, Trials = trials };
|
||||
|
||||
List<HighScore> highScores = null;
|
||||
List<HighScore>? highScores = null;
|
||||
const string FileName = "highscores.json";
|
||||
if (File.Exists(FileName))
|
||||
highScores = JsonSerializer.Deserialize<List<HighScore>>(File.ReadAllText(FileName));
|
||||
highScores =
|
||||
JsonSerializer.Deserialize<List<HighScore>>(File.ReadAllText(FileName))
|
||||
?? new List<HighScore>();
|
||||
|
||||
if (highScores == null)
|
||||
highScores = new List<HighScore>();
|
||||
|
Loading…
Reference in New Issue
Block a user