From 593624655120aa8f8c4bb6545bd97c1b709ebcc6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thorbj=C3=B8rn=20Lindeijer?= Date: Tue, 28 Jan 2025 09:28:13 +0100 Subject: [PATCH] Fixed crash when closing last document with properties selected When there is more than one custom property selected when closing the last document, a crash would occur due to a null pointer dereference while updating the actions on the Properties view tool bar. --- NEWS.md | 3 ++- src/tiled/propertieswidget.cpp | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/NEWS.md b/NEWS.md index d05f91a61a..f14346c887 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,6 +1,7 @@ ### Unreleased -* Fixed potential crash when handling file reloads +* Fixed crash while handling file reloads without any files opened +* Fixed crash when closing the last file with multiple custom properties selected ### Tiled 1.11.1 (11 Jan 2025) diff --git a/src/tiled/propertieswidget.cpp b/src/tiled/propertieswidget.cpp index e118088c2f..467bdbdf54 100644 --- a/src/tiled/propertieswidget.cpp +++ b/src/tiled/propertieswidget.cpp @@ -161,7 +161,7 @@ void PropertiesWidget::updateActions() bool allCustomProperties = !items.isEmpty() && mPropertyBrowser->allCustomPropertyItems(items); bool editingTileset = mDocument && mDocument->type() == Document::TilesetDocumentType; bool isTileset = mPropertyBrowser->object() && mPropertyBrowser->object()->isPartOfTileset(); - bool canModify = allCustomProperties && (!isTileset || editingTileset); + bool canModify = mDocument && allCustomProperties && (!isTileset || editingTileset); // Disable remove and rename actions when none of the selected objects // actually have the selected property (it may be inherited).