GT-3116 - Fixed exception on FillOutStructureCmd due to recent changes

This commit is contained in:
dragonmacher
2019-08-28 18:32:03 -04:00
parent 5f19814d48
commit df971ee613
2 changed files with 1 additions and 26 deletions
@@ -17,11 +17,8 @@ package ghidra.app.plugin.core.decompile;
import ghidra.app.context.NavigatableActionContext;
import ghidra.app.context.RestrictedAddressSetContext;
import ghidra.app.decompiler.ClangToken;
import ghidra.app.decompiler.component.DecompilerPanel;
import ghidra.app.decompiler.component.DecompilerUtils;
import ghidra.program.model.address.Address;
import ghidra.program.util.ProgramLocation;
public class DecompilerActionContext extends NavigatableActionContext
implements RestrictedAddressSetContext {
@@ -51,26 +48,4 @@ public class DecompilerActionContext extends NavigatableActionContext
public DecompilerPanel getDecompilerPanel() {
return getComponentProvider().getDecompilerPanel();
}
@Override
public ProgramLocation getLocation() {
// prefer the selection over the current location
DecompilerPanel decompilerPanel = getDecompilerPanel();
ClangToken token = decompilerPanel.getSelectedToken();
if (token == null) {
token = decompilerPanel.getTokenAtCursor();
}
if (token == null) {
return null;
}
Address address = DecompilerUtils.getClosestAddress(program, token);
if (address == null) {
return null;
}
return new ProgramLocation(program, address);
}
}
@@ -85,7 +85,7 @@ public class FillOutStructureCmd extends BackgroundCommand {
super("Fill Out Structure", true, false, true);
this.tool = tool;
this.currentProgram = program;
this.currentLocation = location;
this.currentLocation = Objects.requireNonNull(location);
}
@Override