Check negative out-of-bounds index in BTextView::OffsetAt(). According to
#4707, this is the BeOS behavior. I have not checked myself and the BeBook is very brief on this, but similar methods do trim indices to be in range. Another alternative would be returning an index indicating an error (-1). git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33439 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -1913,6 +1913,8 @@ BTextView::OffsetAt(BPoint point) const
|
||||
int32
|
||||
BTextView::OffsetAt(int32 line) const
|
||||
{
|
||||
if (line < 0)
|
||||
return 0;
|
||||
if (line > fLines->NumLines())
|
||||
return fText->Length();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user