From 7d4bd57cc56e7b3dfcc168ad6dd1d5f3c56ed253 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Sun, 19 Jan 2020 09:45:47 +0100 Subject: [PATCH] Clang import; Fix crash --- lib/clangimport.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/clangimport.cpp b/lib/clangimport.cpp index 488dcbaee..5e219e484 100644 --- a/lib/clangimport.cpp +++ b/lib/clangimport.cpp @@ -270,8 +270,10 @@ std::string clangimport::AstNode::getSpelling() const int typeIndex = mExtTokens.size() - 1; if (nodeType == FunctionDecl) { - while (mExtTokens[typeIndex][0] != '\'') + while (typeIndex >= 0 && mExtTokens[typeIndex][0] != '\'') typeIndex--; + if (typeIndex <= 0) + return ""; } const std::string &str = mExtTokens[typeIndex - 1]; if (str.compare(0,4,"col:") == 0)