mirror of
https://github.com/vcmi/vcmi.git
synced 2025-08-10 22:31:40 +02:00
Fix crash on scaling empty surface
This commit is contained in:
@@ -120,6 +120,9 @@ const Rect & SDLImageOptimizer::getResultDimensions() const
|
||||
|
||||
void SDLImageScaler::scaleSurface(Point targetDimensions, EScalingAlgorithm algorithm)
|
||||
{
|
||||
if (!intermediate)
|
||||
return; // may happen on scaling of empty images
|
||||
|
||||
if(!targetDimensions.x || !targetDimensions.y)
|
||||
throw std::runtime_error("invalid scaling dimensions!");
|
||||
|
||||
@@ -144,6 +147,9 @@ void SDLImageScaler::scaleSurface(Point targetDimensions, EScalingAlgorithm algo
|
||||
|
||||
void SDLImageScaler::scaleSurfaceIntegerFactor(int factor, EScalingAlgorithm algorithm)
|
||||
{
|
||||
if (!intermediate)
|
||||
return; // may happen on scaling of empty images
|
||||
|
||||
if(factor == 0)
|
||||
throw std::runtime_error("invalid scaling factor!");
|
||||
|
||||
|
Reference in New Issue
Block a user