Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions src/colorer/parsers/TextParserImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -521,8 +521,13 @@ bool TextParser::Impl::colorize(CRegExp* root_end_re, bool lowContentPriority)
clearLine = current_parse_line;
str = lineSource->getLine(current_parse_line);
if (str == nullptr) {
throw Exception("null String passed into the parser: " +
UStr::to_unistr(current_parse_line));
// LineSource can return null if the line is not available (e.g. editor shutdown).
// Stop parsing gracefully instead of throwing across threads.
str = nullptr;
clearLine = -1;
endLine = current_parse_line;
stackLevel--;
return true;
}
regionHandler->clearLine(current_parse_line, str);
}
Expand Down
4 changes: 3 additions & 1 deletion src/colorer/strings/legacy/UnicodeString.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#include <colorer/strings/legacy/Encodings.h>
#include <colorer/strings/legacy/UnicodeString.h>
#include <cstdlib>
#include <string>
#include "colorer/Exception.h"

UnicodeString operator+(const UnicodeString& s1, const UnicodeString& s2)
Expand Down Expand Up @@ -90,7 +91,8 @@ UnicodeString::UnicodeString(const UnicodeString& cstring, int32_t s, int32_t l)

UnicodeString::UnicodeString(int no)
{
CString dtext = CString(std::to_string(no).c_str());
const std::string number_text = std::to_string(no);
CString dtext = CString(number_text.c_str());
construct(&dtext, 0, npos);
}

Expand Down
Loading