From a6fa7bf5b672fe91a1f02bc3c36a54c944077d5a Mon Sep 17 00:00:00 2001 From: Graham Date: Sat, 27 Mar 2021 11:19:02 +0000 Subject: [PATCH] Throw exception before importing a cache if its master index is empty Signed-off-by: Graham --- .../main/kotlin/org/openrs2/archive/cache/CacheImporter.kt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/archive/src/main/kotlin/org/openrs2/archive/cache/CacheImporter.kt b/archive/src/main/kotlin/org/openrs2/archive/cache/CacheImporter.kt index aca396da21..c961ac314f 100644 --- a/archive/src/main/kotlin/org/openrs2/archive/cache/CacheImporter.kt +++ b/archive/src/main/kotlin/org/openrs2/archive/cache/CacheImporter.kt @@ -101,6 +101,10 @@ public class CacheImporter @Inject constructor( // import master index val masterIndex = createMasterIndex(store) + if (masterIndex.index.entries.isEmpty()) { + throw IOException("Master index empty, cache probably corrupt") + } + val masterIndexId = try { addMasterIndex(connection, masterIndex) } finally {