From 409007cd926316e2991e954f040e3283aa49c8c7 Mon Sep 17 00:00:00 2001 From: rubidium Date: Sun, 3 Jan 2010 15:25:51 +0000 Subject: (svn r18697) -Fix [FS#3471]: crash when scrolling to an item removed by filtering in the 'add NewGRF window' --- src/newgrf_gui.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src') 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 */ -- cgit v1.2.3-70-g09d2