Clang import; Fix crash

This commit is contained in:
Daniel Marjamäki 2020-01-19 09:45:47 +01:00
parent 84bb024662
commit 7d4bd57cc5
1 changed files with 3 additions and 1 deletions

View File

@ -270,8 +270,10 @@ std::string clangimport::AstNode::getSpelling() const
int typeIndex = mExtTokens.size() - 1; int typeIndex = mExtTokens.size() - 1;
if (nodeType == FunctionDecl) { if (nodeType == FunctionDecl) {
while (mExtTokens[typeIndex][0] != '\'') while (typeIndex >= 0 && mExtTokens[typeIndex][0] != '\'')
typeIndex--; typeIndex--;
if (typeIndex <= 0)
return "";
} }
const std::string &str = mExtTokens[typeIndex - 1]; const std::string &str = mExtTokens[typeIndex - 1];
if (str.compare(0,4,"col:") == 0) if (str.compare(0,4,"col:") == 0)