fixed a series of crash bugs related to CreateForward() with a NULL typeset

--HG--
extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/trunk%40535
This commit is contained in:
David Anderson 2007-02-26 02:51:14 +00:00
parent e4fdaede32
commit 0b8874e5ec

View File

@ -209,6 +209,7 @@ CForward *CForward::CreateForward(const char *name, ExecType et, unsigned int nu
} else { } else {
for (unsigned int i=0; i<num_params; i++) for (unsigned int i=0; i<num_params; i++)
{ {
_types[i] = types[i];
if (types[i] == Param_VarArgs && (i != num_params - 1)) if (types[i] == Param_VarArgs && (i != num_params - 1))
{ {
return NULL; return NULL;
@ -217,7 +218,7 @@ CForward *CForward::CreateForward(const char *name, ExecType et, unsigned int nu
} }
/* First parameter can never be varargs */ /* First parameter can never be varargs */
if (types[0] == Param_VarArgs) if (num_params && _types[0] == Param_VarArgs)
{ {
return NULL; return NULL;
} }
@ -229,10 +230,10 @@ CForward *CForward::CreateForward(const char *name, ExecType et, unsigned int nu
for (unsigned int i=0; i<num_params; i++) for (unsigned int i=0; i<num_params; i++)
{ {
pForward->m_types[i] = types[i]; pForward->m_types[i] = _types[i];
} }
if (num_params && types[num_params-1] == Param_VarArgs) if (num_params && _types[num_params-1] == Param_VarArgs)
{ {
pForward->m_varargs = num_params--; pForward->m_varargs = num_params--;
} else { } else {