Skip to content

Ghidra is a software reverse engineering (SRE) framework

GP-6517 Corrected missing bookmark table error

ghidra18eb919376444
diff --git a/Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/program/database/bookmark/BookmarkDBAdapterV3.java b/Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/program/database/bookmark/BookmarkDBAdapterV3.java
index 4104e58b6e..20bba256b3 100644
--- a/Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/program/database/bookmark/BookmarkDBAdapterV3.java
+++ b/Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/program/database/bookmark/BookmarkDBAdapterV3.java
@@ -71,27 +71,21 @@ public class BookmarkDBAdapterV3 extends BookmarkDBAdapter {
throw new VersionException(true);
}
else if (typeIDs.length != 0) {
+ int version = -1;
for (int i = 0; i < typeIDs.length; i++) {
int id = typeIDs[i];
- tables[id] = handle.getTable(BOOKMARK_TABLE_NAME + id);
- }
- boolean noTables = (tables[typeIDs[0]] == null);
- int version = noTables ? -1 : tables[typeIDs[0]].getSchema().getVersion();
- for (int i = 1; i < typeIDs.length; i++) {
- int id = typeIDs[i];
- if (noTables) {
- if (tables[id] != null) {
- throw new IOException("Missing bookmark table");
- }
+ String tableName = BOOKMARK_TABLE_NAME + id;
+ Table table = handle.getTable(tableName);
+ if (table == null) {
+ throw new IOException("Missing bookmark table: " + tableName);
}
- else if (tables[id].getSchema().getVersion() != version) {
+ int schemaVersion = table.getSchema().getVersion();
+ if (version >= 0 && schemaVersion != version) {
throw new IOException("Inconsistent bookmark table versions");
}
+ tables[id] = table;
}
- if (noTables) {
- throw new VersionException(true);
- }
- else if (version != VERSION) {
+ if (version >= 0 && version != VERSION) {
throw new VersionException(false);
}
}