mirror of
https://github.com/vcmi/vcmi.git
synced 2025-07-05 00:49:09 +02:00
Fix possible crash on accessing content rect with nullptr surface
This commit is contained in:
@ -352,9 +352,10 @@ Rect SDLImageShared::contentRect() const
|
|||||||
if(upscalingInProgress)
|
if(upscalingInProgress)
|
||||||
throw std::runtime_error("Attempt to access images that is still being loaded!");
|
throw std::runtime_error("Attempt to access images that is still being loaded!");
|
||||||
|
|
||||||
auto tmpMargins = margins;
|
if (!surf)
|
||||||
auto tmpSize = Point(surf->w, surf->h);
|
return Rect();
|
||||||
return Rect(tmpMargins, tmpSize);
|
|
||||||
|
return Rect(margins, Point(surf->w, surf->h));
|
||||||
}
|
}
|
||||||
|
|
||||||
const SDL_Palette * SDLImageShared::getPalette() const
|
const SDL_Palette * SDLImageShared::getPalette() const
|
||||||
|
Reference in New Issue
Block a user