Skip to content

Commit

Permalink
fix: possible crash related to getAttribute function
Browse files Browse the repository at this point in the history
  • Loading branch information
dudantas committed Aug 30, 2023
1 parent e306e7b commit e29bd67
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/items/item.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class Item;
class ItemProperties {
public:
template <typename T>
const T &getAttribute(ItemAttribute_t type) const {
T getAttribute(ItemAttribute_t type) const {
if constexpr (std::is_same_v<T, std::string>) {
return getString(type);
} else {
Expand All @@ -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 {
Expand Down

0 comments on commit e29bd67

Please sign in to comment.