ErrorLogger: Fix crash when error message does not have a FileLocation
This commit is contained in:
parent
8ef9ab26b1
commit
b59bd96c6d
|
@ -415,18 +415,18 @@ std::string ErrorLogger::ErrorMessage::toString(bool verbose, const std::string
|
||||||
|
|
||||||
else if (outputFormat == "clang") {
|
else if (outputFormat == "clang") {
|
||||||
std::ostringstream text;
|
std::ostringstream text;
|
||||||
text << _callStack.back().getfile()
|
if (_callStack.empty()) {
|
||||||
<< ':'
|
text << "nofile:0:0: ";
|
||||||
<< _callStack.back().line
|
} else {
|
||||||
<< ':'
|
const ErrorLogger::ErrorMessage::FileLocation &loc = _callStack.back();
|
||||||
<< _callStack.back().col
|
text << loc.getfile() << ':' << loc.line << ':' << loc.col << ": ";
|
||||||
<< ": "
|
}
|
||||||
<< Severity::toString(_severity)
|
text << Severity::toString(_severity)
|
||||||
<< ": "
|
<< ": "
|
||||||
<< (verbose ? _verboseMessage : _shortMessage)
|
<< (verbose ? _verboseMessage : _shortMessage)
|
||||||
<< " [" << _id << ']';
|
<< " [" << _id << ']';
|
||||||
|
|
||||||
if (_callStack.size() == 1U)
|
if (_callStack.size() <= 1U)
|
||||||
return text.str();
|
return text.str();
|
||||||
|
|
||||||
for (std::list<FileLocation>::const_iterator loc = _callStack.begin(); loc != _callStack.end(); ++loc)
|
for (std::list<FileLocation>::const_iterator loc = _callStack.begin(); loc != _callStack.end(); ++loc)
|
||||||
|
|
Loading…
Reference in New Issue