(svn r17922) -Fix [FS#3291]: crash when closing NewGRF parameter window with no NewGRF selected

This commit is contained in:
rubidium
2009-10-31 14:53:19 +00:00
parent 9059383676
commit 8742314bb8
3 changed files with 13 additions and 7 deletions

View File

@@ -749,6 +749,7 @@ struct NewGRFWindow : public Window {
this->sel = newsel;
this->preset = -1;
this->InvalidateData();
this->DeleteChildWindows(WC_QUERY_STRING); // Remove the parameter query window
break;
}
@@ -791,6 +792,8 @@ struct NewGRFWindow : public Window {
uint i = (pt.y - this->GetWidget<NWidgetBase>(SNGRFS_FILE_LIST)->pos_y) / this->resize.step_height + this->vscroll.GetPosition();
for (c = this->list; c != NULL && i > 0; c = c->next, i--) {}
if (this->sel != c) this->DeleteChildWindows(WC_QUERY_STRING); // Remove the parameter query window
this->sel = c;
this->InvalidateData();