diff --git a/Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/app/emulator/FilteredMemoryState.java b/Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/app/emulator/FilteredMemoryState.java index 0d69dab69de..43f5ae56fa7 100644 --- a/Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/app/emulator/FilteredMemoryState.java +++ b/Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/app/emulator/FilteredMemoryState.java @@ -34,8 +34,12 @@ public int getChunk(byte[] res, AddressSpace spc, long off, int size, int readLen = super.getChunk(res, spc, off, size, stopOnUnintialized); if (filterEnabled && filter != null) { filterEnabled = false; - filter.filterRead(spc, off, readLen, res); - filterEnabled = true; + try { + filter.filterRead(spc, off, readLen, res); + } + finally { + filterEnabled = true; + } } return readLen; } @@ -44,8 +48,12 @@ public int getChunk(byte[] res, AddressSpace spc, long off, int size, public void setChunk(byte[] res, AddressSpace spc, long off, int size) { if (filterEnabled && filter != null) { filterEnabled = false; - filter.filterWrite(spc, off, size, res); - filterEnabled = true; + try { + filter.filterWrite(spc, off, size, res); + } + finally { + filterEnabled = true; + } } super.setChunk(res, spc, off, size); }