From e3df9cc6b106566f3aaada857ce36f868ef5db5d Mon Sep 17 00:00:00 2001
From: Jaime Passos <lazymyuutsu@gmail.com>
Date: Wed, 11 Sep 2019 20:38:15 -0300
Subject: [PATCH] Crash prevention

---
 src/r_data.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/r_data.c b/src/r_data.c
index 2c10e0143f..485de3c40c 100644
--- a/src/r_data.c
+++ b/src/r_data.c
@@ -2744,7 +2744,7 @@ static png_bytep *PNG_Read(UINT8 *png, UINT16 *w, UINT16 *h, INT16 *topoffset, I
 	png_read_image(png_ptr, row_pointers);
 
 	// Read grAB chunk
-	if (topoffset || leftoffset)
+	if ((topoffset || leftoffset) && (chunk.data != NULL))
 	{
 		INT32 *offsets = (INT32 *)chunk.data;
 
-- 
GitLab