From bb6182bafbf247e471428ff0acca1e435ad53f93 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Janiszewski?= Date: Sun, 26 Mar 2023 23:36:36 +0200 Subject: [PATCH] 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 --- src/openrct2-ui/windows/EditorInventionsList.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/openrct2-ui/windows/EditorInventionsList.cpp b/src/openrct2-ui/windows/EditorInventionsList.cpp index 76cc8a1b9d..749c605b99 100644 --- a/src/openrct2-ui/windows/EditorInventionsList.cpp +++ b/src/openrct2-ui/windows/EditorInventionsList.cpp @@ -619,6 +619,7 @@ public: if (inventionListWindow == nullptr) { Close(); + return; } std::optional res; // Skip always researched items, so that the dragged item gets placed underneath them