Skip to content

Commit 68bb724

Browse files
committed
ErrorLogger: do not allocate huge std::string when column is -1
1 parent b888f9c commit 68bb724

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

lib/errorlogger.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -489,7 +489,7 @@ static std::string readCode(const std::string &file, int linenr, int column, con
489489
std::string::size_type pos = 0;
490490
while ((pos = line.find('\t', pos)) != std::string::npos)
491491
line[pos] = ' ';
492-
return line + endl + std::string((column>0 ? column-1 : column), ' ') + '^';
492+
return line + endl + std::string((column>0 ? column-1 : 0), ' ') + '^';
493493
}
494494

495495
static void replaceColors(std::string& source)

0 commit comments

Comments
 (0)