From e6f0667494d994e29f01f4d113920206fe85e65d Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Sun, 27 May 2007 07:28:18 +0000 Subject: [PATCH] flip error case --- stepmania/src/ActorUtil.cpp | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/stepmania/src/ActorUtil.cpp b/stepmania/src/ActorUtil.cpp index bc34017fcd..631ef71fa6 100644 --- a/stepmania/src/ActorUtil.cpp +++ b/stepmania/src/ActorUtil.cpp @@ -143,21 +143,16 @@ Actor* ActorUtil::LoadFromNode( const XNode* pNode, Actor *pParentActor ) sClass = "BitmapText"; } - Actor *pReturn = NULL; - - if( IsRegistered(sClass) ) - { - pReturn = ActorUtil::Create( sClass, pNode, pParentActor ); - } - else // sClass is invalid + if( !IsRegistered(sClass) ) { + // sClass is invalid RString sError = ssprintf( "%s: invalid Class \"%s\"", ActorUtil::GetWhere(pNode).c_str(), sClass.c_str() ); Dialog::OK( sError ); - pReturn = new Actor; // Return a dummy object so that we don't crash in AutoActor later. + return new Actor; // Return a dummy object so that we don't crash in AutoActor later. } - return pReturn; + return ActorUtil::Create( sClass, pNode, pParentActor ); } namespace