summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2010-01-03 15:25:51 +0000
committerrubidium <rubidium@openttd.org>2010-01-03 15:25:51 +0000
commit409007cd926316e2991e954f040e3283aa49c8c7 (patch)
treefedb5a862906c0be530590770602343be40c3db7 /src
parent6e97511bcb11a83931e7ff26f3834f1d69ad1704 (diff)
downloadopenttd-409007cd926316e2991e954f040e3283aa49c8c7.tar.xz
(svn r18697) -Fix [FS#3471]: crash when scrolling to an item removed by filtering in the 'add NewGRF window'
Diffstat (limited to 'src')
-rw-r--r--src/newgrf_gui.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/newgrf_gui.cpp b/src/newgrf_gui.cpp
index 8b7e58ded..f7bed462d 100644
--- a/src/newgrf_gui.cpp
+++ b/src/newgrf_gui.cpp
@@ -216,7 +216,12 @@ private:
void SortGrfList()
{
if (!this->grfs.Sort()) return;
+ this->UpdateListPosition();
+ }
+ /** Update selection position. */
+ void UpdateListPosition()
+ {
/* update list position */
if (this->sel != NULL) {
this->sel_pos = this->grfs.FindIndex(this->sel);
@@ -239,6 +244,7 @@ private:
void FilterGrfList()
{
if (!this->grfs.Filter(this->edit_str_buf)) return;
+ this->UpdateListPosition();
}
/** Make sure that the currently selected grf is within the visible part of the list */