Prevent possible stack overflow if zoom offset is 0

This commit is contained in:
Ted John 2018-12-10 19:54:54 +00:00
parent 76d761c299
commit e13d6da81f
1 changed files with 1 additions and 1 deletions

View File

@ -69,7 +69,7 @@ namespace ObjectJsonHelpers
g1 = *orig;
g1.offset = (uint8_t*)std::malloc(length);
std::memcpy(g1.offset, orig->offset, length);
if (g1.flags & G1_FLAG_HAS_ZOOM_SPRITE)
if ((g1.flags & G1_FLAG_HAS_ZOOM_SPRITE) && g1.zoomed_offset != 0)
{
// Fetch image for next zoom level
next_zoom = std::make_unique<RequiredImage>((uint32_t)(idx - g1.zoomed_offset), getter);