Fix closing invention list window while holding invention

Calling `Close()` on a window deletes its object, rendering any future
uses of its members invalid.

This can be triggered by opening inventions list window, holding an
invention, closing the inventions list window (e.g. with keyboard) and
then releasing the held invention
This commit is contained in:
Michał Janiszewski 2023-03-26 23:36:36 +02:00
parent 801d760487
commit bb6182bafb
1 changed files with 1 additions and 0 deletions

View File

@ -619,6 +619,7 @@ public:
if (inventionListWindow == nullptr)
{
Close();
return;
}
std::optional<InventionListItem> res;
// Skip always researched items, so that the dragged item gets placed underneath them