Skip to content

Ghidra is a software reverse engineering (SRE) framework

Fixed missing help; fixed action enablement

dragonmacherac00cf7e3066
diff --git a/Ghidra/Features/Base/src/main/help/help/topics/DataPlugin/Data.htm b/Ghidra/Features/Base/src/main/help/help/topics/DataPlugin/Data.htm
index 413088eef9..beaa5b789b 100644
--- a/Ghidra/Features/Base/src/main/help/help/topics/DataPlugin/Data.htm
+++ b/Ghidra/Features/Base/src/main/help/help/topics/DataPlugin/Data.htm
@@ -1365,7 +1365,7 @@
</BLOCKQUOTE>
</BLOCKQUOTE>
- <H2><A name="Edit_Field"></A>Quick Editing of a Structure or Union Field</H2>
+ <H2><A name="Edit_Field"></A><A name="Quick_Edit_Field">Quick Editing of a Structure or Union Field</H2>
<BLOCKQUOTE>
<P>As a convenience, a structure or union field can be edited directly from the listing without
bringing up the entire structure or union editor. To edit a field, click anywhere on the line
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/data/DataPlugin.java b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/data/DataPlugin.java
index e832c6e6de..d1e77cac2d 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/data/DataPlugin.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/data/DataPlugin.java
@@ -842,8 +842,15 @@ public class DataPlugin extends Plugin implements DataService {
private boolean canEditField(ListingActionContext context) {
ProgramLocation location = context.getLocation();
- int[] componentPath = location.getComponentPath();
- return componentPath != null && componentPath.length > 0;
+ int[] path = location.getComponentPath();
+ if (path == null || path.length == 0) {
+ return false;
+ }
+
+ Program program = context.getProgram();
+ Address address = location.getAddress();
+ DataTypeComponent dtc = DataTypeUtils.getDataTypeComponent(program, address, path);
+ return dtc != null;
}
private void editField(ListingActionContext context) {
@@ -854,10 +861,6 @@ public class DataPlugin extends Plugin implements DataService {
int[] path = location.getComponentPath();
DataTypeComponent dtc = DataTypeUtils.getDataTypeComponent(program, address, path);
- if (dtc == null) {
- return;
- }
-
DataType parent = dtc.getParent();
Composite composite = (Composite) parent;
int ordinal = dtc.getOrdinal();