diff --git a/CHANGES b/CHANGES index 26685c872..6dc5bcdce 100644 --- a/CHANGES +++ b/CHANGES @@ -95,6 +95,7 @@ Emulation fixes: Other fixes: - 3DS: Fix screen darkening (fixes mgba.io/i/1562) - Core: Fix uninitialized memory issues with graphics caches + - Core: Return null for out of bounds cached tile VRAM querying - Vita: Fix analog controls (fixes mgba.io/i/1554) - Qt: Fix fast forward mute being reset (fixes mgba.io/i/1574) - Qt: Fix scrollbar arrows in memory view (fixes mgba.io/i/1558) diff --git a/src/core/tile-cache.c b/src/core/tile-cache.c index 8272c52fa..89b4a52cb 100644 --- a/src/core/tile-cache.c +++ b/src/core/tile-cache.c @@ -281,5 +281,9 @@ const color_t* mTileCacheGetPalette(struct mTileCache* cache, unsigned paletteId } const uint16_t* mTileCacheGetVRAM(struct mTileCache* cache, unsigned tileId) { + unsigned tiles = mTileCacheSystemInfoGetMaxTiles(cache->sysConfig); + if (tileId >= tiles) { + return NULL; + } return &cache->vram[tileId << (cache->bpp + 2)]; } diff --git a/src/platform/qt/AssetView.cpp b/src/platform/qt/AssetView.cpp index f77b779bb..20dbd1641 100644 --- a/src/platform/qt/AssetView.cpp +++ b/src/platform/qt/AssetView.cpp @@ -66,6 +66,9 @@ void AssetView::showEvent(QShowEvent*) { } void AssetView::compositeTile(const void* tBuffer, void* buffer, size_t stride, size_t x, size_t y, int depth) { + if (!tBuffer) { + return; + } const uint8_t* tile = static_cast(tBuffer); uint8_t* pixels = static_cast(buffer); size_t base = stride * y + x;