From d83f1f98c0aa53e29f86c2aaa64fb8f24de1099c Mon Sep 17 00:00:00 2001 From: Stephen Gold Date: Wed, 20 Sep 2017 14:05:32 -0700 Subject: [PATCH] PopScreenController: minor code cleanup --- .../java/jme3utilities/nifty/PopScreenController.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/nifty/src/main/java/jme3utilities/nifty/PopScreenController.java b/nifty/src/main/java/jme3utilities/nifty/PopScreenController.java index 4d26e2665..fc6acab8f 100644 --- a/nifty/src/main/java/jme3utilities/nifty/PopScreenController.java +++ b/nifty/src/main/java/jme3utilities/nifty/PopScreenController.java @@ -117,6 +117,9 @@ public void activateDialog(String popupId, String actionPrefix, * Make the popup visible, setting the keyboard focus. */ Screen screen = nifty.getCurrentScreen(); + if (screen == null) { + throw new NullPointerException(); + } Element focusElement; if (focusElementId == null) { focusElement = null; @@ -302,9 +305,8 @@ void dialogCommit() { closeActiveDialog(); } else { - @SuppressWarnings("unchecked") - ListBox listBox - = dialogElement.findNiftyControl("#box", ListBox.class); + ListBox listBox; + listBox = dialogElement.findNiftyControl("#box", ListBox.class); TextField textField = dialogElement.findNiftyControl("#textfield", TextField.class);