diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/datamgr/actions/ReplaceDataTypeAction.java b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/datamgr/actions/ReplaceDataTypeAction.java index 4087a40e1d..018935d0cf 100644 --- a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/datamgr/actions/ReplaceDataTypeAction.java +++ b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/datamgr/actions/ReplaceDataTypeAction.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. @@ -67,10 +67,18 @@ public class ReplaceDataTypeAction extends DockingAction { return false; } - if (!(node instanceof DataTypeNode)) { + if (!(node instanceof DataTypeNode dtNode)) { return false; } - return node.isModifiable(); + if (!dtNode.isModifiable()) { + return false; + } + if (dtNode.getDataType() instanceof BadDataType) { + // Although BAD datatype should not appear in tree, if it does replace is + // not supported. Delete should be used instead. + return false; + } + return true; } private DataTypeTreeNode getSelectedDataTypeTreeNode(ActionContext context) {