From a35cddfc0ce24226377a9cc5c664977c2a915626 Mon Sep 17 00:00:00 2001 From: Guillaume Jacquemin Date: Fri, 6 Dec 2024 19:51:50 +0100 Subject: [PATCH] Application: fix crash when weapon has no parts. --- src/Application/Application_MassViewer_Weapons.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/Application/Application_MassViewer_Weapons.cpp b/src/Application/Application_MassViewer_Weapons.cpp index 6834eb8..3935bce 100644 --- a/src/Application/Application_MassViewer_Weapons.cpp +++ b/src/Application/Application_MassViewer_Weapons.cpp @@ -424,6 +424,11 @@ Application::drawWeaponEditor(GameObjects::Weapon& weapon) { ImGui::Separator(); + if(weapon.parts.isEmpty()) { + ImGui::TextUnformatted("This weapon has no parts."); + return; + } + if(ImGui::CollapsingHeader("Weapon parts")) { drawAlignedText("Viewing/editing part:"); for(std::int32_t i = 0; std::size_t(i) < weapon.parts.size(); i++) {