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

git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@345 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
twanvl
2007-05-12 15:38:07 +00:00
parent 0007ae67a6
commit 3ada75f26d
+1 -1
View File
@@ -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);