From da5dac3435bebe880c8eecc62de5858a6411cc18 Mon Sep 17 00:00:00 2001 From: Marcus Hall Date: Tue, 9 Feb 2021 09:50:20 -0700 Subject: [PATCH] If a script cannot be found, don't try to run it. In GhidraScriptComponentProvider.runScript(), if doGetScriptInstance() fails, it writes a diagnostic to the console and returns null. Proceeding to call doRunScript() with this null will result in a null pointer reference, so if doGetScriptInstance() returns null, just cut things off there. --- .../app/plugin/core/script/GhidraScriptComponentProvider.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/script/GhidraScriptComponentProvider.java b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/script/GhidraScriptComponentProvider.java index 4d8c299056..506da19a6b 100644 --- a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/script/GhidraScriptComponentProvider.java +++ b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/script/GhidraScriptComponentProvider.java @@ -612,7 +612,9 @@ public class GhidraScriptComponentProvider extends ComponentProviderAdapter { void runScript(ResourceFile scriptFile, TaskListener listener) { lastRunScript = scriptFile; GhidraScript script = doGetScriptInstance(scriptFile); - doRunScript(script, listener); + if (script != null) { + doRunScript(script, listener); + } } private GhidraScript doGetScriptInstance(ResourceFile scriptFile) {