From f5bcae93b59146e4ed79d335d5e9fc333ead6a79 Mon Sep 17 00:00:00 2001 From: Petr Ohlidal Date: Sat, 1 Oct 2022 02:55:04 +0200 Subject: [PATCH] CharacterPose UI: Tolerate missing anims --- source/main/gui/panels/GUI_CharacterPoseUtil.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/source/main/gui/panels/GUI_CharacterPoseUtil.cpp b/source/main/gui/panels/GUI_CharacterPoseUtil.cpp index 2cf818250c..960996c1d0 100644 --- a/source/main/gui/panels/GUI_CharacterPoseUtil.cpp +++ b/source/main/gui/panels/GUI_CharacterPoseUtil.cpp @@ -253,7 +253,17 @@ void CharacterPoseUtil::DrawAnimDbgItemInline(int id, Ogre::Entity* ent) { CharacterAnimDbg const& dbg = anim_dbg_states[id]; CharacterAnimDef* def = App::GetGameContext()->GetPlayerCharacter()->getCharacterDocument()->getAnimById(id); - AnimationState* as = ent->getAnimationState(def->anim_name); + + AnimationState* as = nullptr; + try + { + as = ent->getAnimationState(def->anim_name); + } + catch (Ogre::ItemIdentityException) + { + ImGui::TextDisabled("ERROR: Animation '%s' does not exist.", def->anim_name.c_str()); + return; + } GUIManager::GuiTheme const& theme = App::GetGuiManager()->GetTheme(); if (dbg.active)