diff --git a/app/src/main/java/io/xpipe/app/core/AppLayoutModel.java b/app/src/main/java/io/xpipe/app/core/AppLayoutModel.java index de0ffc4eb..702070429 100644 --- a/app/src/main/java/io/xpipe/app/core/AppLayoutModel.java +++ b/app/src/main/java/io/xpipe/app/core/AppLayoutModel.java @@ -127,11 +127,13 @@ public class AppLayoutModel { // null) )); - var now = Instant.now(); + var zone = ZoneId.of(ZoneId.SHORT_IDS.get("PST")); + var now = Instant.now(); var phStart = ZonedDateTime.of(2024, 10, 22, 0, 1, 0, 0, zone).toInstant(); + var phEnd = ZonedDateTime.of(2024, 10, 29, 0, 1, 0, 0, zone).toInstant(); var clicked = AppCache.get("phClicked",Boolean.class,() -> false); - var phShow = now.isAfter(phStart) && !clicked; + var phShow = now.isAfter(phStart) && now.isBefore(phEnd) && !clicked; if (phShow) { l.add(new Entry( new SimpleStringProperty("Product Hunt"), diff --git a/app/src/main/java/io/xpipe/app/util/ContextMenuHelper.java b/app/src/main/java/io/xpipe/app/util/ContextMenuHelper.java index 8fa5dfb6d..c614c3500 100644 --- a/app/src/main/java/io/xpipe/app/util/ContextMenuHelper.java +++ b/app/src/main/java/io/xpipe/app/util/ContextMenuHelper.java @@ -43,6 +43,10 @@ public class ContextMenuHelper { public static void toggleShow(ContextMenu contextMenu, Node ref, Side side) { if (!contextMenu.isShowing()) { + // Prevent NPE in show() + if (contextMenu.getScene() == null || ref == null || ref.getScene() == null) { + return; + } contextMenu.show(ref, side, 0, 0); } else { contextMenu.hide();