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, 7 insertions, 2 deletions
diff --git a/core/image.cpp b/core/image.cpp
index dd8f2b9bac..18a3aae88f 100644
--- a/core/image.cpp
+++ b/core/image.cpp
@@ -1372,6 +1372,7 @@ void Image::shrink_x2() {
int new_size = data.size() - ofs;
new_img.resize(new_size);
+ ERR_FAIL_COND(new_img.size() == 0);
{
PoolVector<uint8_t>::Write w = new_img.write();
@@ -1391,6 +1392,7 @@ void Image::shrink_x2() {
ERR_FAIL_COND(!_can_modify(format));
int ps = get_format_pixel_size(format);
new_img.resize((width / 2) * (height / 2) * ps);
+ ERR_FAIL_COND(new_img.size() == 0);
{
PoolVector<uint8_t>::Write w = new_img.write();
@@ -1464,7 +1466,10 @@ Error Image::generate_mipmaps(bool p_renormalize) {
ERR_FAIL_V(ERR_UNAVAILABLE);
}
- ERR_FAIL_COND_V(width == 0 || height == 0, ERR_UNCONFIGURED);
+ if (width == 0 || height == 0) {
+ ERR_EXPLAIN("Cannot generate mipmaps with width or height equal to 0.");
+ ERR_FAIL_V(ERR_UNCONFIGURED);
+ }
int mmcount;
@@ -2532,7 +2537,7 @@ Color Image::get_pixel(int p_x, int p_y) const {
}
void Image::set_pixelv(const Point2 &p_dst, const Color &p_color) {
- return set_pixel(p_dst.x, p_dst.y, p_color);
+ set_pixel(p_dst.x, p_dst.y, p_color);
}
void Image::set_pixel(int p_x, int p_y, const Color &p_color) {