Skip to content

Commit

Permalink
Fix for issue #137
Browse files Browse the repository at this point in the history
  • Loading branch information
eteran committed Nov 18, 2019
1 parent f086797 commit bab8df2
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/TextArea.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2981,9 +2981,11 @@ uint32_t TextArea::styleOfPos(TextCursor lineStartPos, int64_t lineLen, int64_t
/* store in the BACKLIGHT_MASK portion of style the background color class
of the character thisChar */
if (!bgClass_.empty()) {
style |= (bgClass_[static_cast<size_t>(thisChar)] << BACKLIGHT_SHIFT);
auto index = static_cast<size_t>(thisChar);
if (index < bgClass_.size()) {
style |= (bgClass_[index] << BACKLIGHT_SHIFT);
}
}

return style;
}

Expand Down Expand Up @@ -3541,8 +3543,8 @@ void TextArea::setupBGClasses(const QString &str) {
return;
}

std::array<uint8_t, 256> bgClass;
std::array<QColor, 256> bgClassColors;
std::array<uint8_t, 256> bgClass = {};
std::array<QColor, 256> bgClassColors = {};

// default for all chars is class number zero, for standard background
bgClassColors[0] = bgColorDefault;
Expand Down

0 comments on commit bab8df2

Please sign in to comment.