From d8b0e335f36c0357d406e1980822723f54d12b18 Mon Sep 17 00:00:00 2001 From: delvh Date: Sat, 4 Jul 2020 16:07:10 +0200 Subject: [PATCH] Apply suggestions from code review --- src/main/java/envoy/client/ui/SceneContext.java | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/main/java/envoy/client/ui/SceneContext.java b/src/main/java/envoy/client/ui/SceneContext.java index 825c959..a027395 100644 --- a/src/main/java/envoy/client/ui/SceneContext.java +++ b/src/main/java/envoy/client/ui/SceneContext.java @@ -149,10 +149,8 @@ public final class SceneContext { stage.sizeToScene(); // If the controller implements the Restorable interface, // the actions to perform on restoration will be executed here - try { - final Restorable restorable = (Restorable) controllerStack.peek(); - restorable.onRestore(); - } catch (final ClassCastException e) {} + final var controller = controllerStack.peek(); + if (controller instanceof Restorable) ((Restorable) controller).onRestore(); } stage.show(); }