From ad005febddbee0fd7d4dd2a20c74abe0ca2be52a Mon Sep 17 00:00:00 2001 From: Christian Semmler Date: Wed, 24 Jan 2024 12:01:11 -0500 Subject: [PATCH] Match LegoImage::Read --- LEGO1/lego/sources/misc/legoimage.cpp | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/LEGO1/lego/sources/misc/legoimage.cpp b/LEGO1/lego/sources/misc/legoimage.cpp index 7b083c06..0fe72f3d 100644 --- a/LEGO1/lego/sources/misc/legoimage.cpp +++ b/LEGO1/lego/sources/misc/legoimage.cpp @@ -109,9 +109,11 @@ LegoResult LegoImage::Read(LegoStorage* p_storage, LegoU32 p_square) LegoU8* dst = newBits; for (LegoU32 row = 0; row < m_height; row++) { - for (LegoU32 dup = aspect; dup; dup--) { - memcpy(dst, src, m_width); - dst += m_width; + if (aspect) { + for (LegoU32 dup = aspect; dup; dup--) { + memcpy(dst, src, m_width); + dst += m_width; + } } src += m_width; } @@ -126,9 +128,11 @@ LegoResult LegoImage::Read(LegoStorage* p_storage, LegoU32 p_square) for (LegoU32 row = 0; row < m_height; row++) { for (LegoU32 col = 0; col < m_width; col++) { - for (LegoU32 dup = aspect; dup; dup--) { - *dst = *src; - dst++; + if (aspect) { + for (LegoU32 dup = aspect; dup; dup--) { + *dst = *src; + dst++; + } } src++;