prevent from npe when host is removed

This commit is contained in:
gnembon committed 2019-10-18 22:31:33 -03:00
1 parent 2eb50c3931
commit 88d2ad75ad
1 file changed
+2 -2
@@ -372,10 +372,10 @@ public class CarpetScriptServer
public boolean runas(BlockPos origin, ServerCommandSource source, String hostname, String udf_name, List<LazyValue> argv) public boolean runas(BlockPos origin, ServerCommandSource source, String hostname, String udf_name, List<LazyValue> argv)
{ {
ScriptHost host = globalHost; ScriptHost host = globalHost;
if (hostname != null)
host = modules.get(hostname).retrieveForExecution(source);
try try
{ {
if (hostname != null)
host = modules.get(hostname).retrieveForExecution(source);
host.callUDF(origin, source, host.globalFunctions.get(udf_name), argv); host.callUDF(origin, source, host.globalFunctions.get(udf_name), argv);
} }
catch (NullPointerException | InvalidCallbackException npe) catch (NullPointerException | InvalidCallbackException npe)