Fix crash in terminal : GetLinecolor was accessing lines with negative offsets.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@39684 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Adrien Destugues 2010-11-30 20:09:43 +00:00
parent 4264efcc6b
commit 150b717e5b
2 changed files with 5 additions and 2 deletions

View File

@ -448,7 +448,8 @@ BasicTerminalBuffer::LineLength(int32 index) const
int32
BasicTerminalBuffer::GetLineColor(int32 index) const
{
TerminalLine* line = _LineAt(index);
TerminalLine* lineBuffer = ALLOC_LINE_ON_STACK(fWidth);
TerminalLine* line = _HistoryLineAt(index, lineBuffer);
return line != NULL ? line->attributes : 0;
}

View File

@ -1428,7 +1428,9 @@ TermView::Draw(BRect updateRect)
SetHighColor(fSelectBackColor);
FillRect(rect);
} else {
uint32 backcolor = IS_BACKCOLOR(fVisibleTextBuffer->GetLineColor(j));
int lineIndexInHistory = j + fTextBuffer->HistorySize();
uint32 backcolor = IS_BACKCOLOR(fVisibleTextBuffer->GetLineColor(
lineIndexInHistory));
rgb_color rgb_back = kTermColorTable[backcolor];
SetHighColor(rgb_back);
FillRect(rect);