From 0a95076da462e12cd5fc42175609a1437d711f12 Mon Sep 17 00:00:00 2001 From: UnknownShadow200 Date: Tue, 26 Nov 2024 08:08:55 +1100 Subject: [PATCH] NDS: Fix crashing when downloading resources fails --- src/Resources.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Resources.c b/src/Resources.c index b434abf85..210e4c0d1 100644 --- a/src/Resources.c +++ b/src/Resources.c @@ -922,6 +922,8 @@ static void PatchTerrainTile(struct Bitmap* src, int srcX, int srcY, int tileX, static const cc_string terrainPng = String_FromConst("terrain.png"); struct ResourceZipEntry* entry = ZipEntries_Find(&terrainPng); struct Bitmap* dst = &entry->value.bmp; + /* Can happen sometimes happen when allocating memory for terrain.png fails */ + if (!dst->scan0) return; Bitmap_UNSAFE_CopyBlock(srcX, srcY, tileX * 16, tileY * 16, src, dst, 16); }