diff options
Diffstat (limited to 'core')
-rw-r--r-- | core/bind/core_bind.cpp | 8 | ||||
-rw-r--r-- | core/image.cpp | 7 |
2 files changed, 12 insertions, 3 deletions
diff --git a/core/bind/core_bind.cpp b/core/bind/core_bind.cpp index 27a04faef4..2921626f3a 100644 --- a/core/bind/core_bind.cpp +++ b/core/bind/core_bind.cpp @@ -71,7 +71,13 @@ Ref<ResourceInteractiveLoader> _ResourceLoader::load_interactive(const String &p RES _ResourceLoader::load(const String &p_path, const String &p_type_hint, bool p_no_cache) { - RES ret = ResourceLoader::load(p_path, p_type_hint, p_no_cache); + Error err = OK; + RES ret = ResourceLoader::load(p_path, p_type_hint, p_no_cache, &err); + + if (err != OK) { + ERR_EXPLAIN("Error loading resource: '" + p_path + "'"); + ERR_FAIL_COND_V(err != OK, ret); + } return ret; } diff --git a/core/image.cpp b/core/image.cpp index 59d66fd66a..41d70e6df6 100644 --- a/core/image.cpp +++ b/core/image.cpp @@ -447,8 +447,6 @@ void Image::convert(Format p_new_format) { Image new_img(width, height, 0, p_new_format); - //int len=data.size(); - PoolVector<uint8_t>::Read r = data.read(); PoolVector<uint8_t>::Write w = new_img.data.write(); @@ -696,6 +694,11 @@ void Image::resize_to_po2(bool p_square) { void Image::resize(int p_width, int p_height, Interpolation p_interpolation) { + if (data.size() == 0) { + ERR_EXPLAIN("Cannot resize image before creating it, use create() or create_from_data() first."); + ERR_FAIL(); + } + if (!_can_modify(format)) { ERR_EXPLAIN("Cannot resize in indexed, compressed or custom image formats."); ERR_FAIL(); |