summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/TxdStore.cpp2
-rw-r--r--src/TxdStore.h7
2 files changed, 7 insertions, 2 deletions
diff --git a/src/TxdStore.cpp b/src/TxdStore.cpp
index 291feb2f..6ff7e852 100644
--- a/src/TxdStore.cpp
+++ b/src/TxdStore.cpp
@@ -29,7 +29,7 @@ CTxdStore::GameShutdown(void)
for(i = 0; i < TXDSTORESIZE; i++){
TxdDef *def = GetSlot(i);
- if(def && GetNumRefs(i))
+ if(def && GetNumRefs(i) == 0)
RemoveTxdSlot(i);
}
}
diff --git a/src/TxdStore.h b/src/TxdStore.h
index 50a94a75..a9e57d31 100644
--- a/src/TxdStore.h
+++ b/src/TxdStore.h
@@ -34,6 +34,11 @@ public:
static bool FinishLoadTxd(int slot, RwStream *stream);
static void RemoveTxd(int slot);
- static TxdDef *GetSlot(int slot) { return ms_pTxdPool->GetSlot(slot); }
+ static TxdDef *GetSlot(int slot) {
+ assert(slot >= 0);
+ assert(ms_pTxdPool);
+ assert(slot < ms_pTxdPool->GetSize());
+ return ms_pTxdPool->GetSlot(slot);
+ }
static bool isTxdLoaded(int slot);
};