GP-6517 Additional fix for missing bookmark table

This commit is contained in:
ghidra1
2026-02-27 18:36:05 -05:00
parent 8eb9193764
commit 2ae550ae34
2 changed files with 9 additions and 8 deletions

View File

@@ -76,12 +76,11 @@ public class BookmarkDBAdapterV3 extends BookmarkDBAdapter {
int id = typeIDs[i];
String tableName = BOOKMARK_TABLE_NAME + id;
Table table = handle.getTable(tableName);
if (table == null) {
throw new IOException("Missing bookmark table: " + tableName);
}
int schemaVersion = table.getSchema().getVersion();
if (version >= 0 && schemaVersion != version) {
throw new IOException("Inconsistent bookmark table versions");
if (table != null) {
int schemaVersion = table.getSchema().getVersion();
if (version >= 0 && schemaVersion != version) {
throw new IOException("Inconsistent bookmark table versions");
}
}
tables[id] = table;
}

View File

@@ -103,7 +103,7 @@ public class BookmarkDBManager implements BookmarkManager, ErrorHandler, Manager
int typeId = (int) rec.getKey();
BookmarkTypeDB type =
new BookmarkTypeDB(typeId, rec.getString(BookmarkTypeDBAdapter.TYPE_NAME_COL));
type.setHasBookmarks(true);
type.setHasBookmarks(bookmarkAdapter.hasTable(typeId));
typesByName.put(type.getTypeString(), type);
typesArray.put(typeId, type);
}
@@ -208,9 +208,11 @@ public class BookmarkDBManager implements BookmarkManager, ErrorHandler, Manager
typesArray.put(typeId, bmt);
}
if (create && !bmt.hasBookmarks()) {
// Ensure that both type record and bookmarks table exists
bookmarkTypeAdapter.addType(bmt.getTypeId(), bmt.getTypeString());
bmt.setHasBookmarks(true);
bookmarkAdapter.addType(bmt.getTypeId());
bmt.setHasBookmarks(true);
// fire event
program.setObjChanged(ProgramEvent.BOOKMARK_TYPE_ADDED, bmt, null, null);