when there's a sensible error handling path, prefer to use it instead of asserting
This commit is contained in:
@@ -1260,6 +1260,9 @@ OptionRowHandler* OptionRowHandlerUtil::Make( const Commands &cmds )
|
|||||||
{
|
{
|
||||||
OptionRowHandler* pHand = NULL;
|
OptionRowHandler* pHand = NULL;
|
||||||
|
|
||||||
|
if( cmds.v.size() == 0 )
|
||||||
|
return NULL;
|
||||||
|
|
||||||
const RString &name = cmds.v[0].GetName();
|
const RString &name = cmds.v[0].GetName();
|
||||||
|
|
||||||
#define MAKE( type ) { type *p = new type; p->Load( cmds ); pHand = p; }
|
#define MAKE( type ) { type *p = new type; p->Load( cmds ); pHand = p; }
|
||||||
@@ -1267,11 +1270,10 @@ OptionRowHandler* OptionRowHandlerUtil::Make( const Commands &cmds )
|
|||||||
// XXX: merge these, and merge "Steps" and "list,Steps"
|
// XXX: merge these, and merge "Steps" and "list,Steps"
|
||||||
if( name == "list" )
|
if( name == "list" )
|
||||||
{
|
{
|
||||||
ASSERT( cmds.v.size() == 1 );
|
|
||||||
const Command &command = cmds.v[0];
|
const Command &command = cmds.v[0];
|
||||||
RString sParam = command.GetArg(1);
|
RString sParam = command.GetArg(1);
|
||||||
ASSERT( command.m_vsArgs.size() == 2 );
|
if( command.m_vsArgs.size() != 2 || !sParam.size() )
|
||||||
ASSERT( sParam.size() );
|
return NULL;
|
||||||
|
|
||||||
if( sParam.CompareNoCase("NoteSkins")==0 ) MAKE( OptionRowHandlerListNoteSkins )
|
if( sParam.CompareNoCase("NoteSkins")==0 ) MAKE( OptionRowHandlerListNoteSkins )
|
||||||
else if( sParam.CompareNoCase("Steps")==0 ) MAKE( OptionRowHandlerListSteps )
|
else if( sParam.CompareNoCase("Steps")==0 ) MAKE( OptionRowHandlerListSteps )
|
||||||
|
|||||||
Reference in New Issue
Block a user