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:
		| @@ -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; | ||||
|   | ||||
		Reference in New Issue
	
	Block a user