Fix crash in group GUI vehicle/group dragging
See: https://github.com/OpenTTD/OpenTTD/issues/8332
This commit is contained in:
@@ -881,7 +881,13 @@ public:
|
|||||||
|
|
||||||
void OnDragDrop_Group(Point pt, int widget)
|
void OnDragDrop_Group(Point pt, int widget)
|
||||||
{
|
{
|
||||||
const Group *g = Group::Get(this->group_sel);
|
const Group *g = Group::GetIfValid(this->group_sel);
|
||||||
|
if (g == nullptr) {
|
||||||
|
this->group_sel = INVALID_GROUP;
|
||||||
|
this->group_over = INVALID_GROUP;
|
||||||
|
this->SetDirty();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
switch (widget) {
|
switch (widget) {
|
||||||
case WID_GL_ALL_VEHICLES: // All vehicles
|
case WID_GL_ALL_VEHICLES: // All vehicles
|
||||||
@@ -1055,6 +1061,7 @@ public:
|
|||||||
/* abort drag & drop */
|
/* abort drag & drop */
|
||||||
this->vehicle_sel = INVALID_VEHICLE;
|
this->vehicle_sel = INVALID_VEHICLE;
|
||||||
this->DirtyHighlightedGroupWidget();
|
this->DirtyHighlightedGroupWidget();
|
||||||
|
this->group_sel = INVALID_GROUP;
|
||||||
this->group_over = INVALID_GROUP;
|
this->group_over = INVALID_GROUP;
|
||||||
this->SetWidgetDirty(WID_GL_LIST_VEHICLE);
|
this->SetWidgetDirty(WID_GL_LIST_VEHICLE);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user