From fedb08c8453fd51ebf82201f3f27dde640b107fc Mon Sep 17 00:00:00 2001 From: dragonmacher <48328597+dragonmacher@users.noreply.github.com> Date: Tue, 29 Oct 2024 11:11:31 -0400 Subject: [PATCH] Test fixes --- .../util/table/field/CodeUnitTableColumn.java | 8 ++++++-- .../ghidra/util/table/field/LabelTableColumn.java | 14 ++++++++++++-- .../docking/widgets/table/MappedTableColumn.java | 3 +++ 3 files changed, 21 insertions(+), 4 deletions(-) diff --git a/Ghidra/Features/Base/src/main/java/ghidra/util/table/field/CodeUnitTableColumn.java b/Ghidra/Features/Base/src/main/java/ghidra/util/table/field/CodeUnitTableColumn.java index 786c09dfb4..30305591c3 100644 --- a/Ghidra/Features/Base/src/main/java/ghidra/util/table/field/CodeUnitTableColumn.java +++ b/Ghidra/Features/Base/src/main/java/ghidra/util/table/field/CodeUnitTableColumn.java @@ -4,9 +4,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -61,6 +61,10 @@ public class CodeUnitTableColumn @Override public CodeUnitTableCellData getValue(ProgramLocation rowObject, Settings settings, Program data, ServiceProvider serviceProvider) throws IllegalArgumentException { + if (rowObject == null) { + return null; // This can happen when using mapped table columns + } + ProgramLocation loc = rowObject; return new CodeUnitTableCellData(loc, getCodeUnitFormat(serviceProvider), CODE_UNIT_OFFSET.getOffset(settings), CODE_UNIT_COUNT.getCount(settings)); diff --git a/Ghidra/Features/Base/src/main/java/ghidra/util/table/field/LabelTableColumn.java b/Ghidra/Features/Base/src/main/java/ghidra/util/table/field/LabelTableColumn.java index ae3579f980..d6ad39996a 100644 --- a/Ghidra/Features/Base/src/main/java/ghidra/util/table/field/LabelTableColumn.java +++ b/Ghidra/Features/Base/src/main/java/ghidra/util/table/field/LabelTableColumn.java @@ -4,9 +4,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -51,6 +51,10 @@ public class LabelTableColumn @Override public String getValue(ProgramLocation rowObject, Settings settings, Program program, ServiceProvider serviceProvider) throws IllegalArgumentException { + if (rowObject == null) { + return null; // This can happen when using mapped table columns + } + if (rowObject instanceof LabelFieldLocation) { LabelFieldLocation labelFieldLocation = (LabelFieldLocation) rowObject; return labelFieldLocation.getSymbolPath().getName(); @@ -70,6 +74,12 @@ public class LabelTableColumn private Symbol getSymbol(ProgramLocation rowObject, Program program) throws IllegalArgumentException { + if (rowObject == null) { + // this can happen when a bookmark is deleted and we use a mapping column that can no + // longer find the bookmark for the BookmarkRowObject + return null; + } + ProgramLocation location = rowObject; if (rowObject instanceof VariableLocation) { Variable var = ((VariableLocation) rowObject).getVariable(); diff --git a/Ghidra/Framework/Docking/src/main/java/docking/widgets/table/MappedTableColumn.java b/Ghidra/Framework/Docking/src/main/java/docking/widgets/table/MappedTableColumn.java index 5455b88af1..2a07d7db64 100644 --- a/Ghidra/Framework/Docking/src/main/java/docking/widgets/table/MappedTableColumn.java +++ b/Ghidra/Framework/Docking/src/main/java/docking/widgets/table/MappedTableColumn.java @@ -125,6 +125,9 @@ public class MappedTableColumn