Skip to content

Commit

Permalink
Merge pull request #139 from Kylemc1413/fix/null-hash
Browse files Browse the repository at this point in the history
Fix an issue when retrieving extra data in the editor
  • Loading branch information
Meivyn authored Mar 26, 2024
2 parents 7090eea + fb92491 commit 65096d5
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
1 change: 1 addition & 0 deletions source/SongCore/Collections.cs
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ internal static void AddExtraSongData(string hash, string path, string rawSongDa

if (!beatmapLevel.hasPrecalculatedData)
{
// TODO: Will be null in the editor due to levelID being "custom_level_CustomLevel".
songData = RetrieveExtraSongData(Hashing.GetCustomLevelHash(beatmapLevel));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ private void SetCosmeticCharacteristic(BeatmapCharacteristicSegmentedControlCont
return;
}

var extraSongData = Collections.RetrieveExtraSongData(Hashing.GetCustomLevelHash(beatmapLevel)!);
var extraSongData = Collections.RetrieveExtraSongData(Hashing.GetCustomLevelHash(beatmapLevel));
if (extraSongData?._characteristicDetails == null || extraSongData._characteristicDetails.Length == 0)
{
return;
Expand Down
6 changes: 3 additions & 3 deletions source/SongCore/Utilities/Hashing.cs
Original file line number Diff line number Diff line change
Expand Up @@ -119,18 +119,18 @@ private static bool GetCachedSongData(string customLevelPath, out long directory
return false;
}

public static string? GetCustomLevelHash(BeatmapLevel level)
public static string GetCustomLevelHash(BeatmapLevel level)
{
var standardLevelInfoSaveData = Collections.GetStandardLevelInfoSaveData(level.levelID);
if (standardLevelInfoSaveData == null)
{
return null;
return string.Empty;
}

var customLevelPath = Collections.GetCustomLevelPath(level.levelID);
if (string.IsNullOrEmpty(customLevelPath))
{
return null;
return string.Empty;
}

return GetCustomLevelHash(customLevelPath, standardLevelInfoSaveData.difficultyBeatmapSets);
Expand Down

0 comments on commit 65096d5

Please sign in to comment.