GP-1778 corrected table null checking for AddressRangeMapDB

This commit is contained in:
ghidra1 2022-05-03 09:27:21 -04:00
parent 58a3e57193
commit bfe3dcfb95

View file

@ -252,7 +252,7 @@ public class AddressRangeMapDB implements DBListener {
*/ */
public void moveAddressRange(Address fromAddr, Address toAddr, long length, TaskMonitor monitor) public void moveAddressRange(Address fromAddr, Address toAddr, long length, TaskMonitor monitor)
throws CancelledException { throws CancelledException {
if (length <= 0) { if (length <= 0 || rangeMapTable == null) {
return; return;
} }
@ -337,6 +337,9 @@ public class AddressRangeMapDB implements DBListener {
*/ */
public AddressSet getAddressSet(Field value) { public AddressSet getAddressSet(Field value) {
AddressSet set = new AddressSet(); AddressSet set = new AddressSet();
if (rangeMapTable == null) {
return set;
}
lock.acquire(); lock.acquire();
try { try {
RecordIterator it = rangeMapTable.indexIterator(VALUE_COL, value, value, true); RecordIterator it = rangeMapTable.indexIterator(VALUE_COL, value, value, true);
@ -865,6 +868,9 @@ public class AddressRangeMapDB implements DBListener {
} }
private DBRecord getRecordAfter(Address address) throws IOException { private DBRecord getRecordAfter(Address address) throws IOException {
if (rangeMapTable == null) {
return null;
}
RecordIterator it = new AddressKeyRecordIterator(rangeMapTable, addressMap, address, true); RecordIterator it = new AddressKeyRecordIterator(rangeMapTable, addressMap, address, true);
if (it.hasNext()) { if (it.hasNext()) {
return it.next(); return it.next();
@ -873,6 +879,9 @@ public class AddressRangeMapDB implements DBListener {
} }
private DBRecord getRecordAtOrBefore(Address address) throws IOException { private DBRecord getRecordAtOrBefore(Address address) throws IOException {
if (rangeMapTable == null) {
return null;
}
RecordIterator it = new AddressKeyRecordIterator(rangeMapTable, addressMap, address, false); RecordIterator it = new AddressKeyRecordIterator(rangeMapTable, addressMap, address, false);
if (it.hasPrevious()) { if (it.hasPrevious()) {
return it.previous(); return it.previous();
@ -881,6 +890,9 @@ public class AddressRangeMapDB implements DBListener {
} }
private DBRecord getRecordBefore(Address address) throws IOException { private DBRecord getRecordBefore(Address address) throws IOException {
if (rangeMapTable == null) {
return null;
}
RecordIterator it = new AddressKeyRecordIterator(rangeMapTable, addressMap, address, true); RecordIterator it = new AddressKeyRecordIterator(rangeMapTable, addressMap, address, true);
if (it.hasPrevious()) { if (it.hasPrevious()) {
return it.previous(); return it.previous();