summaryrefslogtreecommitdiff
path: root/core/image.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'core/image.cpp')
-rw-r--r--core/image.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/core/image.cpp b/core/image.cpp
index 59d66fd66a..07e705265d 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();
@@ -772,7 +775,7 @@ void Image::crop_from_point(int p_x, int p_y, int p_width, int p_height) {
ERR_FAIL_COND(p_y + p_height > MAX_HEIGHT);
/* to save memory, cropping should be done in-place, however, since this function
- will most likely either not be used much, or in critical areas, for now it wont, because
+ will most likely either not be used much, or in critical areas, for now it won't, because
it's a waste of time. */
if (p_width == width && p_height == height && p_x == 0 && p_y == 0)