Skip to content

Commit

Permalink
Fix potential nullref throw on failed startup
Browse files Browse the repository at this point in the history
  • Loading branch information
peppy committed Sep 16, 2021
1 parent b399f91 commit edb1230
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
7 changes: 5 additions & 2 deletions osu.Game/Database/DatabaseContextFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -163,8 +163,11 @@ public void ResetDatabase()

public void FlushConnections()
{
foreach (var context in threadContexts.Values)
context.Dispose();
if (threadContexts != null)
{
foreach (var context in threadContexts.Values)
context.Dispose();
}

recycleThreadContexts();
}
Expand Down
2 changes: 1 addition & 1 deletion osu.Game/OsuGameBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -527,7 +527,7 @@ protected override void Dispose(bool isDisposing)
BeatmapManager?.Dispose();
LocalConfig?.Dispose();

contextFactory.FlushConnections();
contextFactory?.FlushConnections();
}
}
}

0 comments on commit edb1230

Please sign in to comment.