Merge pull request #97 from aothms/dynamic_lib_fixes_2

Dynamic lib fixes
This commit is contained in:
Thomas Krijnen
2016-06-22 14:57:16 +02:00
committed by GitHub
3 changed files with 17 additions and 8 deletions
+2 -2
View File
@@ -560,9 +560,9 @@ double TokenFunc::asFloat(const Token& t) {
const std::string &TokenFunc::asStringRef(const Token& t) {
std::string &str = t.lexer->GetTempString();
t.lexer->TokenString(t.startPos, str);
if (isString(t) || isEnumeration(t) || isBinary(t)) {
if ((isString(t) || isEnumeration(t) || isBinary(t)) && !str.empty()) {
//remove start+end characters in-place
str.pop_back();
str.erase(str.end()-1);
str.erase(str.begin());
}
return str;