From 91328a86cd4d0ad00008383f0f74b3a5cbfe3698 Mon Sep 17 00:00:00 2001 From: kobewi Date: Tue, 1 Aug 2023 22:51:52 +0200 Subject: [PATCH] Ignore null "id" in tile source proxy --- editor/plugins/tiles/tile_set_editor.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/editor/plugins/tiles/tile_set_editor.cpp b/editor/plugins/tiles/tile_set_editor.cpp index f620e434ab1..afff905f973 100644 --- a/editor/plugins/tiles/tile_set_editor.cpp +++ b/editor/plugins/tiles/tile_set_editor.cpp @@ -1002,10 +1002,15 @@ bool TileSourceInspectorPlugin::can_handle(Object *p_object) { bool TileSourceInspectorPlugin::parse_property(Object *p_object, const Variant::Type p_type, const String &p_path, const PropertyHint p_hint, const String &p_hint_text, const BitField p_usage, const bool p_wide) { if (p_path == "id") { + const Variant value = p_object->get("id"); + if (value.get_type() == Variant::NIL) { // May happen if the object is not yet initialized. + return true; + } + HBoxContainer *hbox = memnew(HBoxContainer); hbox->set_alignment(BoxContainer::ALIGNMENT_CENTER); - id_label = memnew(Label(vformat(TTR("ID: %d"), p_object->get("id")))); + id_label = memnew(Label(vformat(TTR("ID: %d"), value))); hbox->add_child(id_label); Button *button = memnew(Button(TTR("Edit")));