Preprocessor: Fix crashes for invalid code
This commit is contained in:
parent
804d4194bb
commit
f1839ebfaf
|
@ -219,10 +219,12 @@ static void getConfigs(const simplecpp::TokenList &tokens, std::set<std::string>
|
||||||
configs_ifndef.push_back((tok->next->str == "ifndef") ? config : std::string());
|
configs_ifndef.push_back((tok->next->str == "ifndef") ? config : std::string());
|
||||||
ret.insert(cfg(configs_if));
|
ret.insert(cfg(configs_if));
|
||||||
} else if (tok->next->str == "elif") {
|
} else if (tok->next->str == "elif") {
|
||||||
|
if (!configs_if.empty())
|
||||||
configs_if.pop_back();
|
configs_if.pop_back();
|
||||||
configs_if.push_back(readcondition(tok->next, defined));
|
configs_if.push_back(readcondition(tok->next, defined));
|
||||||
ret.insert(cfg(configs_if));
|
ret.insert(cfg(configs_if));
|
||||||
} else if (tok->next->str == "else") {
|
} else if (tok->next->str == "else") {
|
||||||
|
if (!configs_if.empty())
|
||||||
configs_if.pop_back();
|
configs_if.pop_back();
|
||||||
configs_if.push_back(configs_ifndef.back());
|
configs_if.push_back(configs_ifndef.back());
|
||||||
ret.insert(cfg(configs_if));
|
ret.insert(cfg(configs_if));
|
||||||
|
|
Loading…
Reference in New Issue