From 53d030c7e16987f8652d4e8dad93b56fe885fa64 Mon Sep 17 00:00:00 2001 From: eidheim Date: Fri, 3 Jul 2015 16:18:09 +0200 Subject: [PATCH] Minor fix. --- src/Tokens.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Tokens.cc b/src/Tokens.cc index 11e654d..8d12f27 100644 --- a/src/Tokens.cc +++ b/src/Tokens.cc @@ -42,11 +42,11 @@ std::vector clang::Tokens::get_token_cursors(clang::TranslationUn auto type=clang_getCursorType(referenced); std::string spelling=clang_getCString(clang_getTypeSpelling(type)); std::string auto_end=""; - if(spelling.substr(0, 4)=="auto") { + if(spelling.size()>=4 && spelling.substr(0, 4)=="auto") { auto_end=spelling.substr(4); auto type=clang_getCanonicalType(clang_getCursorType(cursors[c].cursor_)); spelling=clang_getCString(clang_getTypeSpelling(type)); - if(spelling.substr(0, 4)!="auto" && spelling.substr(4)!=auto_end) + if(spelling.size()>=4 && spelling.substr(0, 4)!="auto" && spelling.substr(4)!=auto_end) spelling+=auto_end; } tks[c].type=spelling;