Skip to content

Commit

Permalink
null checks to try and prevent a crash
Browse files Browse the repository at this point in the history
  • Loading branch information
ShadowMario committed Aug 17, 2024
1 parent 4721496 commit 8145cb2
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions source/states/editors/ChartingState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -2243,7 +2243,8 @@ class ChartingState extends MusicBeatState implements PsychUIEventHandler.PsychU
var _lastGfSection:Null<Bool> = null;
function updateHeads(ignoreCheck:Bool = false):Void
{
var isGfSection:Bool = (PlayState.SONG.notes[curSec].gfSection == true);
var curSecData:SwagSection = PlayState.SONG.notes[curSec];
var isGfSection:Bool = (curSecData != null && curSecData.gfSection == true);
if(_lastGfSection == isGfSection && _lastSec == curSec && !ignoreCheck) return; //optimization

for (i in 0...GRID_PLAYERS)
Expand All @@ -2258,7 +2259,7 @@ class ChartingState extends MusicBeatState implements PsychUIEventHandler.PsychU
{
var iconP1:HealthIcon = icons[0];
var iconP2:HealthIcon = icons[1];
var mustHitSection:Bool = (PlayState.SONG.notes[curSec].mustHitSection == true);
var mustHitSection:Bool = (curSecData != null && curSecData.mustHitSection == true);
if (isGfSection)
{
if (mustHitSection)
Expand Down

0 comments on commit 8145cb2

Please sign in to comment.