From 774da9a584cfc7e675f91f49ec612b54c76ab8c9 Mon Sep 17 00:00:00 2001 From: Jan Date: Thu, 8 Aug 2024 18:50:11 +0200 Subject: [PATCH] chore: log exception when parsing weapon attachment json fails --- .../Game/IW5/Weapon/JsonWeaponAttachmentLoader.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/ObjLoading/Game/IW5/Weapon/JsonWeaponAttachmentLoader.cpp b/src/ObjLoading/Game/IW5/Weapon/JsonWeaponAttachmentLoader.cpp index 5957ba83..71a77664 100644 --- a/src/ObjLoading/Game/IW5/Weapon/JsonWeaponAttachmentLoader.cpp +++ b/src/ObjLoading/Game/IW5/Weapon/JsonWeaponAttachmentLoader.cpp @@ -44,8 +44,17 @@ namespace return false; } - const auto jAttachment = jRoot.get(); - return CreateWeaponAttachmentFromJson(jAttachment, attachment); + try + { + const auto jAttachment = jRoot.get(); + return CreateWeaponAttachmentFromJson(jAttachment, attachment); + } + catch (const json::exception& e) + { + std::cerr << std::format("Failed to parse json of attachment: {}\n", e.what()); + } + + return false; } private: