summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author mooglyguy <therealmogminer@gmail.com>2018-07-05 13:13:00 +0200
committer mooglyguy <therealmogminer@gmail.com>2018-07-05 13:14:18 +0200
commit9d509bd29c33a331cee2778c3a0bbf7d0d14c8dc (patch)
tree3b6647b54b71ab626c9a1b288a60800f8d28176b
parentba4f99c559d008f3f328dcff01ec8de335601091 (diff)
Fix divtlb crash, nw
-rw-r--r--src/emu/divtlb.cpp12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/emu/divtlb.cpp b/src/emu/divtlb.cpp
index d6cc8b34e21..c227147cad9 100644
--- a/src/emu/divtlb.cpp
+++ b/src/emu/divtlb.cpp
@@ -179,10 +179,16 @@ bool device_vtlb_interface::vtlb_fill(offs_t address, int intention)
{
int liveindex = m_dynindex++ % m_dynamic;
+
// if an entry already exists at this index, free it
- if (m_live[liveindex] != 0 && m_refcnt[m_live[liveindex] - 1] <= 1)
- m_table[m_live[liveindex] - 1] = 0;
- m_refcnt[m_live[liveindex] - 1]--;
+ if (m_live[liveindex] != 0)
+ {
+ if (m_refcnt[m_live[liveindex] - 1] <= 1)
+ m_table[m_live[liveindex] - 1] = 0;
+ else
+ m_refcnt[m_live[liveindex] - 1]--;
+ }
+
// claim this new entry
m_live[liveindex] = tableindex + 1;