From 88d2ad75adbcba97c629f9ae68c8c50bc268259e Mon Sep 17 00:00:00 2001 From: gnembon Date: Fri, 18 Oct 2019 22:31:33 -0300 Subject: [PATCH] prevent from npe when host is removed --- src/main/java/carpet/script/CarpetScriptServer.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/carpet/script/CarpetScriptServer.java b/src/main/java/carpet/script/CarpetScriptServer.java index 3c92548f..bd083a98 100644 --- a/src/main/java/carpet/script/CarpetScriptServer.java +++ b/src/main/java/carpet/script/CarpetScriptServer.java @@ -372,10 +372,10 @@ public class CarpetScriptServer public boolean runas(BlockPos origin, ServerCommandSource source, String hostname, String udf_name, List argv) { ScriptHost host = globalHost; - if (hostname != null) - host = modules.get(hostname).retrieveForExecution(source); try { + if (hostname != null) + host = modules.get(hostname).retrieveForExecution(source); host.callUDF(origin, source, host.globalFunctions.get(udf_name), argv); } catch (NullPointerException | InvalidCallbackException npe)