From 9470f1f99f1273b0bc8a2acd6d1f605579a5cbc6 Mon Sep 17 00:00:00 2001 From: Anuken Date: Wed, 19 Aug 2020 11:03:04 -0400 Subject: [PATCH] Unit control null checks --- core/src/mindustry/input/InputHandler.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/core/src/mindustry/input/InputHandler.java b/core/src/mindustry/input/InputHandler.java index 3fb7d31065..a696659c1f 100644 --- a/core/src/mindustry/input/InputHandler.java +++ b/core/src/mindustry/input/InputHandler.java @@ -156,6 +156,8 @@ public abstract class InputHandler implements InputProcessor, GestureListener{ @Remote(targets = Loc.client, called = Loc.server) public static void dropItem(Player player, float angle){ + if(player == null) return; + if(net.server() && player.unit().stack.amount <= 0){ throw new ValidateException(player, "Player cannot drop an item."); } @@ -208,7 +210,7 @@ public abstract class InputHandler implements InputProcessor, GestureListener{ @Remote(targets = Loc.both, called = Loc.both, forward = true) public static void tileConfig(Player player, Building tile, @Nullable Object value){ - if(tile == null) return; + if(tile == null || player == null) return; if(net.server() && (!Units.canInteract(player, tile) || !netServer.admins.allowAction(player, ActionType.configure, tile.tile(), action -> action.config = value))) throw new ValidateException(player, "Player cannot configure a tile."); tile.configured(player, value); @@ -217,6 +219,8 @@ public abstract class InputHandler implements InputProcessor, GestureListener{ @Remote(targets = Loc.both, called = Loc.both, forward = true) public static void unitControl(Player player, @Nullable Unit unit){ + if(player == null) return; + //clear player unit when they possess a core if((unit instanceof BlockUnitc && ((BlockUnitc)unit).tile() instanceof CoreBuild)){ Fx.spawn.at(player);