mirror of https://github.com/OpenTTD/OpenTTD.git
(svn r18697) -Fix [FS#3471]: crash when scrolling to an item removed by filtering in the 'add NewGRF window'
This commit is contained in:
parent
6e97511bcb
commit
409007cd92
|
@ -216,7 +216,12 @@ private:
|
||||||
void SortGrfList()
|
void SortGrfList()
|
||||||
{
|
{
|
||||||
if (!this->grfs.Sort()) return;
|
if (!this->grfs.Sort()) return;
|
||||||
|
this->UpdateListPosition();
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Update selection position. */
|
||||||
|
void UpdateListPosition()
|
||||||
|
{
|
||||||
/* update list position */
|
/* update list position */
|
||||||
if (this->sel != NULL) {
|
if (this->sel != NULL) {
|
||||||
this->sel_pos = this->grfs.FindIndex(this->sel);
|
this->sel_pos = this->grfs.FindIndex(this->sel);
|
||||||
|
@ -239,6 +244,7 @@ private:
|
||||||
void FilterGrfList()
|
void FilterGrfList()
|
||||||
{
|
{
|
||||||
if (!this->grfs.Filter(this->edit_str_buf)) return;
|
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 */
|
/** Make sure that the currently selected grf is within the visible part of the list */
|
||||||
|
|
Loading…
Reference in New Issue