aboutsummaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authoraliaspider2014-10-30 01:09:02 +0100
committeraliaspider2014-10-30 01:09:02 +0100
commit628df4d2923b5a42e0378c4ede89178f85e0e0c8 (patch)
tree4e7d1af8dde4b3a7226461126048a443fa470db4 /source
parent804169dd621a3ad3eec1a32ce30350de667fee80 (diff)
downloadsnesemu-628df4d2923b5a42e0378c4ede89178f85e0e0c8.tar.gz
snesemu-628df4d2923b5a42e0378c4ede89178f85e0e0c8.tar.bz2
snesemu-628df4d2923b5a42e0378c4ede89178f85e0e0c8.zip
prevent a segfault.
Diffstat (limited to 'source')
-rw-r--r--source/tile.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/source/tile.c b/source/tile.c
index 38ac831..2211421 100644
--- a/source/tile.c
+++ b/source/tile.c
@@ -467,6 +467,9 @@ static void WRITE_4PIXELS16_ADD(int32 Offset, uint8* Pixels,
uint16* ScreenColors)
{
uint8 Pixel, N;
+ if (Offset < 0)
+ Offset = 0;
+
uint16* Screen = (uint16*) GFX.S + Offset;
uint8* Depth = GFX.ZBuffer + Offset;
uint8* SubDepth = GFX.SubZBuffer + Offset;
@@ -496,6 +499,9 @@ static void WRITE_4PIXELS16_FLIPPED_ADD(int32 Offset, uint8* Pixels,
uint16* ScreenColors)
{
uint8 Pixel, N;
+ if (Offset < 0)
+ Offset = 0;
+
uint16* Screen = (uint16*) GFX.S + Offset;
uint8* Depth = GFX.ZBuffer + Offset;
uint8* SubDepth = GFX.SubZBuffer + Offset;