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(); }