From e29bd675459520531bf6814bbb269ba33d8e826d Mon Sep 17 00:00:00 2001 From: Eduardo Dantas Date: Tue, 29 Aug 2023 23:51:09 -0300 Subject: [PATCH] fix: possible crash related to getAttribute function --- src/items/item.hpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/items/item.hpp b/src/items/item.hpp index c6b3f82413f..db7ea154d8c 100644 --- a/src/items/item.hpp +++ b/src/items/item.hpp @@ -35,7 +35,7 @@ class Item; class ItemProperties { public: template - const T &getAttribute(ItemAttribute_t type) const { + T getAttribute(ItemAttribute_t type) const { if constexpr (std::is_same_v) { return getString(type); } else { @@ -47,8 +47,7 @@ class ItemProperties { } g_logger().error("Failed to convert attribute for type {}", fmt::underlying(type)); - static T defaultType; - return defaultType; + return {}; } bool hasAttribute(ItemAttribute_t type) const {