From c9bfbf84244c8aa4e26ece994ef6b93386c708e3 Mon Sep 17 00:00:00 2001 From: Treeki Date: Sun, 23 Sep 2012 17:43:33 +0200 Subject: tons of junk I'll clean up eventually --- NW4RTools/Texture.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'NW4RTools/Texture.cs') diff --git a/NW4RTools/Texture.cs b/NW4RTools/Texture.cs index f2cf231..249af79 100644 --- a/NW4RTools/Texture.cs +++ b/NW4RTools/Texture.cs @@ -437,8 +437,10 @@ namespace NW4RTools { byte val = data.ReadByte(); for (int inX = 0; inX < 4; inX++) { - uint *pPixel = (uint*)pRow + x + (iBlockX * 4) + inX; - *pPixel = clrArray[(val >> 6) & 3]; + if ((y + (iBlockY * 4) + inY) < height && (x + (iBlockX * 4) + inX) < width) { + uint *pPixel = (uint*)pRow + x + (iBlockX * 4) + inX; + *pPixel = clrArray[(val >> 6) & 3]; + } val <<= 2; } } -- cgit v1.2.3