Skip to content

Commit

Permalink
Fix exception when slider doesn't have a head note
Browse files Browse the repository at this point in the history
  • Loading branch information
nicoco007 committed Oct 28, 2024
1 parent cbd9aca commit e0bf7fe
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion Source/CustomAvatar/Utilities/BeatmapObjectEventFilter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,12 @@ private bool ParentWasAlreadyTriggered(NoteController noteController, NoteCutRes

NoteData headNote = GetHeadNote(noteData);

// TODO: handle sliders with no head note properly
if (headNote == null)
{
return true;
}

if (_noteCutResults.TryGetValue(headNote, out NoteCutResult existingResult))
{
if (existingResult.HasFlag(noteCutResult))
Expand All @@ -145,7 +151,7 @@ private bool ParentWasAlreadyTriggered(NoteController noteController, NoteCutRes

private NoteData GetHeadNote(NoteData noteData)
{
return _burstSliderHeadNoteDatas.First(nd => nd.time <= noteData.time && nd.colorType == noteData.colorType);
return _burstSliderHeadNoteDatas.FirstOrDefault(nd => nd.time <= noteData.time && nd.colorType == noteData.colorType);
}

[Flags]
Expand Down

0 comments on commit e0bf7fe

Please sign in to comment.