From b86a82fb4208638392224166e4e0dc001c3c4c43 Mon Sep 17 00:00:00 2001 From: Jason Felds Date: Mon, 17 Oct 2011 21:37:30 -0400 Subject: [PATCH] Fix issue 585: editor crash w/o saving. This does not feel like a proper cure, but it does stop the crashing. --- Docs/Changelog_sm5.txt | 5 +++++ src/NoteField.cpp | 16 ++++++++++------ 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/Docs/Changelog_sm5.txt b/Docs/Changelog_sm5.txt index cf7ce28394..ea33248842 100644 --- a/Docs/Changelog_sm5.txt +++ b/Docs/Changelog_sm5.txt @@ -8,6 +8,11 @@ ________________________________________________________________________________ StepMania 5.0 $next | 2011xxxx -------------------------------------------------------------------------------- +2011/10/17 +---------- +* [ScreenEdit/NoteField] Fix an editor crash when you exit without saving + after creating new steps. [Wolfman2000] + 2011/10/16 ---------- * [NoteDataUtil] Add the Backwards mod for games where the intended diff --git a/src/NoteField.cpp b/src/NoteField.cpp index affa91454a..325990dc3f 100644 --- a/src/NoteField.cpp +++ b/src/NoteField.cpp @@ -1079,14 +1079,18 @@ void NoteField::DrawPrimitives() AttackArray &attacks = GAMESTATE->m_bIsUsingStepTiming ? GAMESTATE->m_pCurSteps[PLAYER_1]->m_Attacks : GAMESTATE->m_pCurSong->m_Attacks; - FOREACH_CONST(Attack, attacks, a) + // XXX: We're somehow getting here when attacks is null. Find the actual cause later. + if (&attacks) { - float fBeat = timing.GetBeatFromElapsedTime(a->fStartSecond); - if (BeatToNoteRow(fBeat) >= iFirstRowToDraw && - BeatToNoteRow(fBeat) <= iLastRowToDraw && - IS_ON_SCREEN(fBeat)) + FOREACH_CONST(Attack, attacks, a) { - this->DrawAttackText(fBeat, *a); + float fBeat = timing.GetBeatFromElapsedTime(a->fStartSecond); + if (BeatToNoteRow(fBeat) >= iFirstRowToDraw && + BeatToNoteRow(fBeat) <= iLastRowToDraw && + IS_ON_SCREEN(fBeat)) + { + this->DrawAttackText(fBeat, *a); + } } } }