Check MakeActor rvs for NULL
This commit is contained in:
@@ -201,6 +201,8 @@ bool ActorUtil::LoadTableFromStackShowErrors( Lua *L )
|
||||
return true;
|
||||
}
|
||||
|
||||
// NOTE: This function can return NULL if the actor should not be displayed.
|
||||
// Callers should be aware of this and handle it appropriately.
|
||||
Actor* ActorUtil::MakeActor( const RString &sPath_, Actor *pParentActor )
|
||||
{
|
||||
RString sPath( sPath_ );
|
||||
|
||||
@@ -520,6 +520,8 @@ void BGAnimationLayer::LoadFromNode( const XNode* pNode )
|
||||
for( unsigned i=0; i<NumSprites; i++ )
|
||||
{
|
||||
Actor* pSprite = ActorUtil::MakeActor( sFile, this );
|
||||
if( pSprite == NULL )
|
||||
continue;
|
||||
this->AddChild( pSprite );
|
||||
pSprite->SetTextureWrapping( true ); // gets rid of some "cracks"
|
||||
pSprite->SetZoom( randomf(fZoomMin,fZoomMax) );
|
||||
|
||||
+2
-1
@@ -373,7 +373,8 @@ bool BackgroundImpl::Layer::CreateBackground( const Song *pSong, const Backgroun
|
||||
|
||||
Actor *pActor = ActorUtil::MakeActor( sEffectFile );
|
||||
|
||||
ASSERT( pActor != NULL );
|
||||
if( pActor == NULL )
|
||||
pActor = new Actor;
|
||||
m_BGAnimations[bd] = pActor;
|
||||
|
||||
for( unsigned i=0; i<vsResolvedRef.size(); i++ )
|
||||
|
||||
+23
-10
@@ -26,22 +26,35 @@ void ComboGraph::Load( RString sMetricsGroup )
|
||||
Actor *pActor = NULL;
|
||||
|
||||
m_pBacking = ActorUtil::MakeActor( THEME->GetPathG(sMetricsGroup,"Backing") );
|
||||
m_pBacking->ZoomToWidth( BODY_WIDTH );
|
||||
this->AddChild( m_pBacking );
|
||||
if( m_pBacking != NULL )
|
||||
{
|
||||
m_pBacking->ZoomToWidth( BODY_WIDTH );
|
||||
this->AddChild( m_pBacking );
|
||||
}
|
||||
|
||||
m_pNormalCombo = ActorUtil::MakeActor( THEME->GetPathG(sMetricsGroup,"NormalCombo") );
|
||||
m_pNormalCombo->ZoomToWidth( BODY_WIDTH );
|
||||
this->AddChild( m_pNormalCombo );
|
||||
if( m_pNormalCombo != NULL )
|
||||
{
|
||||
m_pNormalCombo->ZoomToWidth( BODY_WIDTH );
|
||||
this->AddChild( m_pNormalCombo );
|
||||
}
|
||||
|
||||
m_pMaxCombo = ActorUtil::MakeActor( THEME->GetPathG(sMetricsGroup,"MaxCombo") );
|
||||
m_pMaxCombo->ZoomToWidth( BODY_WIDTH );
|
||||
this->AddChild( m_pMaxCombo );
|
||||
if( m_pMaxCombo != NULL )
|
||||
{
|
||||
m_pMaxCombo->ZoomToWidth( BODY_WIDTH );
|
||||
this->AddChild( m_pMaxCombo );
|
||||
}
|
||||
|
||||
pActor = ActorUtil::MakeActor( THEME->GetPathG(sMetricsGroup,"ComboNumber") );
|
||||
m_pComboNumber = dynamic_cast<BitmapText *>( pActor );
|
||||
if( m_pComboNumber == NULL )
|
||||
RageException::Throw( "ComboGraph: \"sMetricsGroup\" \"ComboNumber\" must be a BitmapText" );
|
||||
this->AddChild( m_pComboNumber );
|
||||
if( pActor != NULL )
|
||||
{
|
||||
m_pComboNumber = dynamic_cast<BitmapText *>( pActor );
|
||||
if( m_pComboNumber != NULL )
|
||||
this->AddChild( m_pComboNumber );
|
||||
else
|
||||
LOG->Warn( "ComboGraph: \"sMetricsGroup\" \"ComboNumber\" must be a BitmapText" );
|
||||
}
|
||||
}
|
||||
|
||||
void ComboGraph::Set( const StageStats &s, const PlayerStageStats &pss )
|
||||
|
||||
@@ -45,6 +45,8 @@ void Foreground::LoadFromSong( const Song *pSong )
|
||||
{
|
||||
bga.m_bga = ActorUtil::MakeActor( pSong->GetSongDir() + sBGName, this );
|
||||
}
|
||||
if( bga.m_bga == NULL )
|
||||
continue;
|
||||
bga.m_bga->SetName( sBGName );
|
||||
bga.m_bga->PlayCommand( "Init" );
|
||||
bga.m_fStartBeat = change.m_fStartBeat;
|
||||
|
||||
+4
-1
@@ -107,7 +107,10 @@ void OptionRowType::Load( const RString &sMetricsGroup, Actor *pParent )
|
||||
m_textTitle.SetName( "Title" );
|
||||
ActorUtil::LoadAllCommandsAndSetXY( m_textTitle, sMetricsGroup );
|
||||
|
||||
m_sprFrame.Load( ActorUtil::MakeActor( THEME->GetPathG(sMetricsGroup,"Frame"), pParent ) );
|
||||
Actor *pActor = ActorUtil::MakeActor( THEME->GetPathG(sMetricsGroup,"Frame"), pParent );
|
||||
if( pActor == NULL )
|
||||
pActor = new Actor;
|
||||
m_sprFrame.Load( pActor );
|
||||
m_sprFrame->SetName( "Frame" );
|
||||
ActorUtil::LoadAllCommandsAndSetXY( m_sprFrame, sMetricsGroup );
|
||||
|
||||
|
||||
@@ -187,7 +187,8 @@ void ScoreScroller::Load( RString sMetricsGroup )
|
||||
for( int i=0; i<iNumCopies; ++i )
|
||||
{
|
||||
Actor *pActor = ActorUtil::MakeActor( THEME->GetPathG(sMetricsGroup,"ScrollerItem") );
|
||||
this->AddChild( pActor );
|
||||
if( pActor != NULL )
|
||||
this->AddChild( pActor );
|
||||
}
|
||||
|
||||
DynamicActorScroller::SetTransformFromReference( THEME->GetMetricR(sMetricsGroup,"ScrollerItemTransformFunction") );
|
||||
|
||||
@@ -584,8 +584,11 @@ void ScreenManager::PrepareScreen( const RString &sScreenName )
|
||||
{
|
||||
LOG->Trace( "Loading screen background \"%s\"", sNewBGA.c_str() );
|
||||
Actor *pActor = ActorUtil::MakeActor( sNewBGA );
|
||||
pActor->SetName( sNewBGA );
|
||||
g_vPreparedBackgrounds.push_back( pActor );
|
||||
if( pActor != NULL )
|
||||
{
|
||||
pActor->SetName( sNewBGA );
|
||||
g_vPreparedBackgrounds.push_back( pActor );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user