From 937ad5c6b87c3c8f3008781471a6dbc6d815aa34 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stephan=20A=C3=9Fmus?= Date: Wed, 22 Jan 2014 23:17:48 +0100 Subject: [PATCH] ParagraphLayout: Off-by-one error in LastOffsetOnLine() --- src/apps/haiku-depot/textview/ParagraphLayout.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/apps/haiku-depot/textview/ParagraphLayout.cpp b/src/apps/haiku-depot/textview/ParagraphLayout.cpp index 4d49ba6432..107a606b3e 100644 --- a/src/apps/haiku-depot/textview/ParagraphLayout.cpp +++ b/src/apps/haiku-depot/textview/ParagraphLayout.cpp @@ -328,8 +328,9 @@ ParagraphLayout::LastOffsetOnLine(int32 lineIndex) if (lineIndex < 0) lineIndex = 0; + if (lineIndex >= fLineInfos.CountItems() - 1) - return CountGlyphs(); + return CountGlyphs() - 1; return fLineInfos.ItemAt(lineIndex + 1).textOffset - 1; }