From 7171cb02905b377ead9eb73e3ed78ccf39299160 Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Sat, 6 Jan 2018 15:59:24 +0100 Subject: [PATCH] Add missing null checks. Fixes gh-299 --- .../lunatrius/schematica/handler/client/InputHandler.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/github/lunatrius/schematica/handler/client/InputHandler.java b/src/main/java/com/github/lunatrius/schematica/handler/client/InputHandler.java index a36af79f..8693e5ff 100644 --- a/src/main/java/com/github/lunatrius/schematica/handler/client/InputHandler.java +++ b/src/main/java/com/github/lunatrius/schematica/handler/client/InputHandler.java @@ -71,7 +71,7 @@ public void onKeyInput(final InputEvent event) { if (KEY_BINDING_LAYER_INC.isPressed()) { final SchematicWorld schematic = ClientProxy.schematic; - if (schematic.layerMode != LayerMode.ALL) { + if (schematic != null && schematic.layerMode != LayerMode.ALL) { schematic.renderingLayer = MathHelper.clamp(schematic.renderingLayer + 1, 0, schematic.getHeight() - 1); RenderSchematic.INSTANCE.refresh(); } @@ -79,7 +79,7 @@ public void onKeyInput(final InputEvent event) { if (KEY_BINDING_LAYER_DEC.isPressed()) { final SchematicWorld schematic = ClientProxy.schematic; - if (schematic.layerMode != LayerMode.ALL) { + if (schematic != null && schematic.layerMode != LayerMode.ALL) { schematic.renderingLayer = MathHelper.clamp(schematic.renderingLayer - 1, 0, schematic.getHeight() - 1); RenderSchematic.INSTANCE.refresh(); }