1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-10-31 00:07:39 +02:00

Fix crash on attempt to flip empty image

This commit is contained in:
Ivan Savenko
2025-01-01 21:00:43 +00:00
parent 51ceb068a7
commit 698d43e195

View File

@@ -404,6 +404,9 @@ std::shared_ptr<IImage> SDLImageShared::createImageReference(EImageBlitMode mode
std::shared_ptr<const ISharedImage> SDLImageShared::horizontalFlip() const
{
if (!surf)
return shared_from_this();
SDL_Surface * flipped = CSDL_Ext::horizontalFlip(surf);
auto ret = std::make_shared<SDLImageShared>(flipped, preScaleFactor);
ret->fullSize = fullSize;
@@ -416,6 +419,9 @@ std::shared_ptr<const ISharedImage> SDLImageShared::horizontalFlip() const
std::shared_ptr<const ISharedImage> SDLImageShared::verticalFlip() const
{
if (!surf)
return shared_from_this();
SDL_Surface * flipped = CSDL_Ext::verticalFlip(surf);
auto ret = std::make_shared<SDLImageShared>(flipped, preScaleFactor);
ret->fullSize = fullSize;