preprocessor: Fixed a null pointer dereference

This commit is contained in:
Daniel Marjamäki 2009-01-16 19:50:39 +00:00
parent 666fc82011
commit a39eaec1cc
1 changed files with 13 additions and 10 deletions

View File

@ -576,6 +576,8 @@ std::string Preprocessor::expandMacros(std::string code)
const Token *tok = tokenizer.tokens(); const Token *tok = tokenizer.tokens();
while (tok && tok->str() != ")") while (tok && tok->str() != ")")
tok = tok->next(); tok = tok->next();
if (tok)
{
while ((tok = tok->next()) != NULL) while ((tok = tok->next()) != NULL)
{ {
std::string str = tok->str(); std::string str = tok->str();
@ -595,6 +597,7 @@ std::string Preprocessor::expandMacros(std::string code)
macrocode += " "; macrocode += " ";
} }
} }
}
// Insert macro code.. // Insert macro code..
if (!macroparams.empty()) if (!macroparams.empty())