summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTyler Greenwood <tygree@umich.edu>2019-12-10 11:23:30 -0500
committerRĂ©mi Verschelde <rverschelde@gmail.com>2019-12-16 13:53:35 +0100
commite4a0abdd93977542d2ace2975670f188c7e5c161 (patch)
treec1640b6aab13f650bb77fd59cc2f05d0b8781bad
parentd4601776db56df158753463b1e669c859b16bc42 (diff)
Fixed a bug within sprite.cpp that caused nan values to appear when a texture had zero area
-rw-r--r--scene/2d/sprite.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/scene/2d/sprite.cpp b/scene/2d/sprite.cpp
index 8cdfceea52..a595f6714b 100644
--- a/scene/2d/sprite.cpp
+++ b/scene/2d/sprite.cpp
@@ -315,6 +315,9 @@ bool Sprite::is_pixel_opaque(const Point2 &p_point) const {
if (texture.is_null())
return false;
+ if (texture->get_size().width == 0 || texture->get_size().height == 0)
+ return false;
+
Rect2 src_rect, dst_rect;
bool filter_clip;
_get_rects(src_rect, dst_rect, filter_clip);