(svn r21812) -Fix (r21754): Don't try to scroll the matrix widget to position -1.

This commit is contained in:
alberth 2011-01-15 19:54:53 +00:00
parent 89f245ab2f
commit a1df4bea68
1 changed files with 1 additions and 1 deletions

View File

@ -1374,7 +1374,7 @@ void NWidgetMatrix::SetColour(Colours colour)
void NWidgetMatrix::SetClicked(int clicked)
{
this->clicked = clicked;
if (this->sb != NULL && this->widgets_x != 0) {
if (this->clicked >= 0 && this->sb != NULL && this->widgets_x != 0) {
int vpos = (this->clicked / this->widgets_x) * this->widget_h; // Vertical position of the top.
/* Need to scroll down -> Scroll to the bottom.
* However, last entry has no 'this->pip_inter' underneath, and we must stay below this->sb->GetCount() */