Skip to content

Commit bbcf5f6

Browse files
authored
Merge pull request #303 from Spartan322/fix/asset-manager-crashes
Fix `AssetManager::get_currency_texture` crashes
2 parents ad5067e + 1e978de commit bbcf5f6

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

extension/src/openvic-extension/singletons/AssetManager.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,9 @@ Error AssetManager::preload_textures() {
217217
return ERR(ret);
218218
}
219219

220-
Ref<GFXSpriteTexture> const& AssetManager::get_currency_texture(real_t height) const {
220+
Ref<GFXSpriteTexture> AssetManager::get_currency_texture(real_t height) const {
221+
ERR_FAIL_NULL_V(currency_texture_big, Ref<GFXSpriteTexture>());
222+
ERR_FAIL_NULL_V(currency_texture_medium, Ref<GFXSpriteTexture>());
221223
if (height > currency_texture_big->get_height()) {
222224
return currency_texture_big;
223225
} else if (height > currency_texture_medium->get_height()) {

extension/src/openvic-extension/singletons/AssetManager.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ namespace OpenVic {
8787
godot::Error preload_textures();
8888

8989
/* Get the largest currency texture with height less than the specified font height. */
90-
godot::Ref<GFXSpriteTexture> const& get_currency_texture(real_t height) const;
90+
godot::Ref<GFXSpriteTexture> get_currency_texture(real_t height) const;
9191
};
9292
}
9393

0 commit comments

Comments
 (0)