From ec1d229339a5db82c390baed1d74ccf701c8721b Mon Sep 17 00:00:00 2001 From: Ben Anderson Date: Thu, 5 May 2005 00:36:14 +0000 Subject: [PATCH] Make sure there actually is a texture before calling methods on it. Also, use Log instead of dialog; dialog isn't available on some platforms (Linux) --- stepmania/src/Sprite.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/stepmania/src/Sprite.cpp b/stepmania/src/Sprite.cpp index 6d9fc886b2..6ed0a722f8 100644 --- a/stepmania/src/Sprite.cpp +++ b/stepmania/src/Sprite.cpp @@ -694,16 +694,14 @@ void Sprite::SetState( int iNewState ) if( iNewState < 0 || iNewState >= (int)m_States.size() ) { // Don't warn about number of states in "_blank". - if( m_pTexture->GetID().filename.Find("_blank") == -1 ) + if( !m_pTexture || m_pTexture->GetID().filename.Find("_blank") == -1 ) { - CString sError; if( m_pTexture ) - sError = ssprintf("The Sprite '%s' (\"%s\") tried to set state index %d, but it has only %u states", + LOG->Warn("The Sprite '%s' (\"%s\") tried to set state index %d, but it has only %u states", m_pTexture->GetID().filename.c_str(), this->m_sName.c_str(), iNewState, unsigned(m_States.size())); else - sError = ssprintf("A Sprite (\"%s\") tried to set state index %d but no texture is loaded.", + LOG->Warn("A Sprite (\"%s\") tried to set state index %d but no texture is loaded.", this->m_sName.c_str(), iNewState ); - Dialog::OK( sError ); } }