Update Sprite.cpp (#2164)

This commit is contained in:
Thang Nguyen 2024-09-19 20:53:45 +07:00 committed by GitHub
parent ef5204385b
commit 1e178b8273
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 2 additions and 2 deletions

View File

@ -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);
@ -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)