X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;f=org.simantics.district.route.ui%2Fsrc%2Forg%2Fsimantics%2Fdistrict%2Froute%2Fui%2Fhandlers%2FSelectRouteOnDiagram.java;h=572c65bf0ecc15871431ca3e470e2ef23b4ecbb8;hb=65c53bff95339c4b45e084b7094084be41b060e2;hp=36d14fc6427167b3c102469e4623f9a77e7af294;hpb=7e64b34b3cdb452a61d02492d6bbed1e671dc749;p=simantics%2Fdistrict.git diff --git a/org.simantics.district.route.ui/src/org/simantics/district/route/ui/handlers/SelectRouteOnDiagram.java b/org.simantics.district.route.ui/src/org/simantics/district/route/ui/handlers/SelectRouteOnDiagram.java index 36d14fc6..572c65bf 100644 --- a/org.simantics.district.route.ui/src/org/simantics/district/route/ui/handlers/SelectRouteOnDiagram.java +++ b/org.simantics.district.route.ui/src/org/simantics/district/route/ui/handlers/SelectRouteOnDiagram.java @@ -1,5 +1,6 @@ package org.simantics.district.route.ui.handlers; +import java.util.Collections; import java.util.List; import java.util.concurrent.CompletableFuture; @@ -47,11 +48,15 @@ public class SelectRouteOnDiagram { Display display = activeShell.getDisplay(); CompletableFuture> result = new CompletableFuture<>(); - result.thenAccept(dnElements -> { - try { - openDiagram(display, dnElements); - } catch (DatabaseException e) { - LOGGER.error("Failed to open district network diagram with selection {}", dnElements); + result + .exceptionally(e -> Collections.emptyList()) + .thenAccept(dnElements -> { + if (!dnElements.isEmpty()) { + try { + openDiagram(display, dnElements); + } catch (DatabaseException e) { + LOGGER.error("Failed to open district network diagram with selection {}", dnElements); //$NON-NLS-1$ + } } });