Commit aeda091b authored by twanvl's avatar twanvl

*maybe* fixed crashes when typing: index was possibly out of bounds altough it...

*maybe* fixed crashes when typing: index was possibly out of bounds altough it should not have happened.
parent 5c2e3a16
......@@ -194,7 +194,7 @@ RealRect TextViewer::charRect(size_t index) const {
if (lines.empty()) return RealRect(0,0,0,0);
const Line& l = findLine(index);
size_t pos = index - l.start;
if (pos >= l.positions.size()) {
if (pos + 1 >= l.positions.size()) {
return RealRect(l.positions.back(), l.top, 0, l.line_height);
} else {
return RealRect(l.positions[pos], l.top, l.positions[pos + 1] - l.positions[pos], l.line_height);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment