Check if the file exists before reading

This is (also) to address the review from bdach about StorageManager initialising a default value that gets overwritten upon migration anyway.
This commit is contained in:
Shivam 2020-06-24 02:40:22 +02:00
parent 839f197111
commit c94f95cc0d
1 changed files with 2 additions and 4 deletions

View File

@ -22,11 +22,9 @@ public TournamentStorage(Storage storage)
TournamentStorageManager storageConfig = new TournamentStorageManager(storage); TournamentStorageManager storageConfig = new TournamentStorageManager(storage);
var currentTournament = storageConfig.Get<string>(StorageConfig.CurrentTournament); if (storage.Exists("tournament.ini"))
if (!string.IsNullOrEmpty(currentTournament))
{ {
ChangeTargetStorage(UnderlyingStorage.GetStorageForDirectory(currentTournament)); ChangeTargetStorage(UnderlyingStorage.GetStorageForDirectory(storageConfig.Get<string>(StorageConfig.CurrentTournament)));
} }
else else
{ {