diff --git a/Ghidra/Features/Decompiler/src/main/java/ghidra/app/plugin/core/decompile/actions/ForceUnionAction.java b/Ghidra/Features/Decompiler/src/main/java/ghidra/app/plugin/core/decompile/actions/ForceUnionAction.java index 022edfad8b..90ae12f7e0 100644 --- a/Ghidra/Features/Decompiler/src/main/java/ghidra/app/plugin/core/decompile/actions/ForceUnionAction.java +++ b/Ghidra/Features/Decompiler/src/main/java/ghidra/app/plugin/core/decompile/actions/ForceUnionAction.java @@ -69,7 +69,14 @@ public class ForceUnionAction extends AbstractDecompilerAction { } Varnode vn = tokenAtCursor.getVarnode(); if (vn != null) { - DataType dt = vn.getHigh().getDataType(); + // Some Varnodes -- volatile-memory loads in particular -- never get + // a HighVariable assigned during decompile, so getHigh() can be null. + // Same guard pattern as typeIsUnionRelated below. + HighVariable high = vn.getHigh(); + if (high == null) { + return null; + } + DataType dt = high.getDataType(); if (dt instanceof TypeDef) { dt = ((TypeDef) dt).getBaseDataType(); }