Skip to content

Commit

Permalink
Update Sprite.cpp (#2164)
Browse files Browse the repository at this point in the history
  • Loading branch information
NgVThangBz authored Sep 19, 2024
1 parent ef52043 commit 1e178b8
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions core/2d/Sprite.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1315,7 +1315,7 @@ void Sprite::setScaleX(float scaleX)
void Sprite::setScaleY(float scaleY)
{
#ifdef AX_USE_METAL
if (_texture->isRenderTarget())
if (_texture &&_texture->isRenderTarget())
scaleY = std::abs(scaleY);
#endif
Node::setScaleY(scaleY);
Expand Down Expand Up @@ -1444,7 +1444,7 @@ bool Sprite::isFlippedX() const
void Sprite::setFlippedY(bool flippedY)
{
#ifdef AX_USE_METAL
if (_texture->isRenderTarget())
if (_texture && _texture->isRenderTarget())
flippedY = !flippedY;
#endif
if (_flippedY != flippedY)
Expand Down

0 comments on commit 1e178b8

Please sign in to comment.