fix crashes
This commit is contained in:
@@ -182,26 +182,33 @@ void ScreenProfileOptions::HandleScreenMessage( const ScreenMessage SM )
|
|||||||
|
|
||||||
void ScreenProfileOptions::MenuStart( PlayerNumber pn, const InputEventType type )
|
void ScreenProfileOptions::MenuStart( PlayerNumber pn, const InputEventType type )
|
||||||
{
|
{
|
||||||
CString sProfileID = GetSelectedProfileID();
|
|
||||||
CString sName = GetSelectedProfileName();
|
|
||||||
|
|
||||||
switch( GetCurrentRow() )
|
switch( GetCurrentRow() )
|
||||||
{
|
{
|
||||||
case PO_CREATE_NEW:
|
case PO_CREATE_NEW:
|
||||||
SCREENMAN->TextEntry( SM_DoneCreating, "Enter a profile name", "", NULL );
|
SCREENMAN->TextEntry( SM_DoneCreating, "Enter a profile name", "", NULL );
|
||||||
break;
|
break;
|
||||||
case PO_DELETE_:
|
case PO_DELETE_:
|
||||||
|
{
|
||||||
|
const CString sProfileID = GetSelectedProfileID();
|
||||||
|
const CString sName = GetSelectedProfileName();
|
||||||
|
|
||||||
if( sProfileID=="" )
|
if( sProfileID=="" )
|
||||||
SOUND->PlayOnce( THEME->GetPathToS("common invalid") );
|
SOUND->PlayOnce( THEME->GetPathToS("common invalid") );
|
||||||
else
|
else
|
||||||
SCREENMAN->Prompt( SM_DoneDeleting, ssprintf("Delete profile %s '%s'?",sProfileID.c_str(),sName.c_str()), true );
|
SCREENMAN->Prompt( SM_DoneDeleting, ssprintf("Delete profile %s '%s'?",sProfileID.c_str(),sName.c_str()), true );
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
case PO_RENAME_:
|
case PO_RENAME_:
|
||||||
|
{
|
||||||
|
const CString sProfileID = GetSelectedProfileID();
|
||||||
|
const CString sName = GetSelectedProfileName();
|
||||||
|
|
||||||
if( sProfileID=="" )
|
if( sProfileID=="" )
|
||||||
SOUND->PlayOnce( THEME->GetPathToS("common invalid") );
|
SOUND->PlayOnce( THEME->GetPathToS("common invalid") );
|
||||||
else
|
else
|
||||||
SCREENMAN->TextEntry( SM_DoneRenaming, ssprintf("Rename profile %s '%s'",sProfileID.c_str(),sName.c_str()), sName, NULL );
|
SCREENMAN->TextEntry( SM_DoneRenaming, ssprintf("Rename profile %s '%s'",sProfileID.c_str(),sName.c_str()), sName, NULL );
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
ScreenOptions::MenuStart( pn, type );
|
ScreenOptions::MenuStart( pn, type );
|
||||||
}
|
}
|
||||||
@@ -212,17 +219,19 @@ CString ScreenProfileOptions::GetSelectedProfileID()
|
|||||||
vector<CString> vsProfiles;
|
vector<CString> vsProfiles;
|
||||||
PROFILEMAN->GetLocalProfileIDs( vsProfiles );
|
PROFILEMAN->GetLocalProfileIDs( vsProfiles );
|
||||||
|
|
||||||
if( m_Rows[GetCurrentRow()]->GetOneSharedSelection() )
|
const Row &row = *m_Rows[GetCurrentRow()];
|
||||||
|
const int Selection = row.GetOneSharedSelection();
|
||||||
|
if( !Selection )
|
||||||
return "";
|
return "";
|
||||||
else
|
return vsProfiles[ Selection-1 ];
|
||||||
return vsProfiles[ m_Rows[GetCurrentRow()]->GetOneSharedSelection()-1];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
CString ScreenProfileOptions::GetSelectedProfileName()
|
CString ScreenProfileOptions::GetSelectedProfileName()
|
||||||
{
|
{
|
||||||
if( m_Rows[GetCurrentRow()]->GetOneSharedSelection() )
|
const Row &row = *m_Rows[GetCurrentRow()];
|
||||||
|
const int Selection = row.GetOneSharedSelection();
|
||||||
|
if( !Selection )
|
||||||
return "";
|
return "";
|
||||||
else
|
return g_ProfileOptionsLines[PO_PLAYER1].choices[ Selection ];
|
||||||
return g_ProfileOptionsLines[PO_PLAYER1].choices[ m_Rows[GetCurrentRow()]->GetOneSharedSelection() ];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user