Skip to content

Commit

Permalink
Make sure level exists when retrieving hash
Browse files Browse the repository at this point in the history
  • Loading branch information
Meivyn committed Apr 21, 2024
1 parent bcaa6b7 commit 95c5f20
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions source/SongCore/Utilities/Hashing.cs
Original file line number Diff line number Diff line change
Expand Up @@ -128,14 +128,16 @@ public static string GetCustomLevelHash(BeatmapLevel level)
{
var hash = string.Empty;

var loadedSaveData = Loader.CustomLevelLoader._loadedBeatmapSaveData[level.levelID];
if (loadedSaveData.standardLevelInfoSaveData != null)
if (Loader.CustomLevelLoader._loadedBeatmapSaveData.TryGetValue(level.levelID, out var loadedSaveData))
{
hash = GetCustomLevelHash(loadedSaveData.customLevelFolderInfo, loadedSaveData.standardLevelInfoSaveData);
}
else if (loadedSaveData.beatmapLevelSaveData != null)
{
hash = GetCustomLevelHash(loadedSaveData.customLevelFolderInfo, loadedSaveData.beatmapLevelSaveData);
if (loadedSaveData.standardLevelInfoSaveData != null)
{
hash = GetCustomLevelHash(loadedSaveData.customLevelFolderInfo, loadedSaveData.standardLevelInfoSaveData);
}
else if (loadedSaveData.beatmapLevelSaveData != null)
{
hash = GetCustomLevelHash(loadedSaveData.customLevelFolderInfo, loadedSaveData.beatmapLevelSaveData);
}
}

return hash;
Expand Down

0 comments on commit 95c5f20

Please sign in to comment.