mirror of
https://github.com/vcmi/vcmi.git
synced 2025-02-05 13:04:54 +02:00
Fix crash on attempt to flip empty image
This commit is contained in:
parent
51ceb068a7
commit
698d43e195
@ -404,6 +404,9 @@ std::shared_ptr<IImage> SDLImageShared::createImageReference(EImageBlitMode mode
|
|||||||
|
|
||||||
std::shared_ptr<const ISharedImage> SDLImageShared::horizontalFlip() const
|
std::shared_ptr<const ISharedImage> SDLImageShared::horizontalFlip() const
|
||||||
{
|
{
|
||||||
|
if (!surf)
|
||||||
|
return shared_from_this();
|
||||||
|
|
||||||
SDL_Surface * flipped = CSDL_Ext::horizontalFlip(surf);
|
SDL_Surface * flipped = CSDL_Ext::horizontalFlip(surf);
|
||||||
auto ret = std::make_shared<SDLImageShared>(flipped, preScaleFactor);
|
auto ret = std::make_shared<SDLImageShared>(flipped, preScaleFactor);
|
||||||
ret->fullSize = fullSize;
|
ret->fullSize = fullSize;
|
||||||
@ -416,6 +419,9 @@ std::shared_ptr<const ISharedImage> SDLImageShared::horizontalFlip() const
|
|||||||
|
|
||||||
std::shared_ptr<const ISharedImage> SDLImageShared::verticalFlip() const
|
std::shared_ptr<const ISharedImage> SDLImageShared::verticalFlip() const
|
||||||
{
|
{
|
||||||
|
if (!surf)
|
||||||
|
return shared_from_this();
|
||||||
|
|
||||||
SDL_Surface * flipped = CSDL_Ext::verticalFlip(surf);
|
SDL_Surface * flipped = CSDL_Ext::verticalFlip(surf);
|
||||||
auto ret = std::make_shared<SDLImageShared>(flipped, preScaleFactor);
|
auto ret = std::make_shared<SDLImageShared>(flipped, preScaleFactor);
|
||||||
ret->fullSize = fullSize;
|
ret->fullSize = fullSize;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user