From 5f0f5498bd80a5ac68f7ff96c52032da008b1561 Mon Sep 17 00:00:00 2001 From: Chris Danford Date: Sun, 18 Jan 2004 04:46:36 +0000 Subject: [PATCH] fix crash when going from ScreenSelectGameMode back to ScreenTitleMenu --- stepmania/src/ScreenSelect.cpp | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/stepmania/src/ScreenSelect.cpp b/stepmania/src/ScreenSelect.cpp index dad574686a..df482ab165 100644 --- a/stepmania/src/ScreenSelect.cpp +++ b/stepmania/src/ScreenSelect.cpp @@ -73,14 +73,25 @@ void ScreenSelect::Update( float fDelta ) } Screen::Update( fDelta ); - int iSelection = this->GetSelectionIndex(GAMESTATE->m_MasterPlayerNumber); - m_BGAnimations[iSelection].Update( fDelta ); + + // GAMESTATE->m_MasterPlayerNumber is set to PLAYER_INVALID when going Back to + // the title screen and this screen is updated after. TODO: find out why + if( GAMESTATE->m_MasterPlayerNumber != PLAYER_INVALID ) + { + int iSelection = this->GetSelectionIndex(GAMESTATE->m_MasterPlayerNumber); + m_BGAnimations[iSelection].Update( fDelta ); + } } void ScreenSelect::DrawPrimitives() { - int iSelection = this->GetSelectionIndex(GAMESTATE->m_MasterPlayerNumber); - m_BGAnimations[iSelection].Draw(); + // GAMESTATE->m_MasterPlayerNumber is set to PLAYER_INVALID when going Back to + // the title screen and this screen is updated after. TODO: find out why + if( GAMESTATE->m_MasterPlayerNumber != PLAYER_INVALID ) + { + int iSelection = this->GetSelectionIndex(GAMESTATE->m_MasterPlayerNumber); + m_BGAnimations[iSelection].Draw(); + } m_Menu.DrawBottomLayer(); Screen::DrawPrimitives(); m_Menu.DrawTopLayer();