From 21fdeabd952f93d51a57df19b124d5b9f6fe9df6 Mon Sep 17 00:00:00 2001 From: Argent77 <4519923+Argent77@users.noreply.github.com> Date: Sat, 10 Jun 2023 14:27:58 +0200 Subject: [PATCH 1/3] Fix date parser error which caused NI from closing --- src/org/infinity/updater/Utils.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/org/infinity/updater/Utils.java b/src/org/infinity/updater/Utils.java index ba80faf75..561b86ee0 100644 --- a/src/org/infinity/updater/Utils.java +++ b/src/org/infinity/updater/Utils.java @@ -89,8 +89,14 @@ public class Utils { *

* * @param s String containing date/time information. + * @return {@code OffsetDateTime} object of the given date string. Returns the current date if {@code null} is + * specified. */ public static OffsetDateTime getDateTimeFromString(String s) throws DateTimeParseException { + if (s == null || s.isEmpty()) { + return OffsetDateTime.now(); + } + DateTimeParseException exception = null; final DateTimeFormatter[] formatters = { ISO_DATE_TIME, From 96ed38c81ce47d02f1ae8d4950efeb70498812b3 Mon Sep 17 00:00:00 2001 From: Argent77 <4519923+Argent77@users.noreply.github.com> Date: Sat, 10 Jun 2023 14:33:53 +0200 Subject: [PATCH 2/3] Options menu entry "Allow launching games" should be disabled if cmd option "-no-launch-game" is specified --- src/org/infinity/NearInfinity.java | 1 + src/org/infinity/gui/BrowserMenuBar.java | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/src/org/infinity/NearInfinity.java b/src/org/infinity/NearInfinity.java index 48a1ed628..6820269d3 100644 --- a/src/org/infinity/NearInfinity.java +++ b/src/org/infinity/NearInfinity.java @@ -358,6 +358,7 @@ private NearInfinity(Options options) { final BrowserMenuBar menu = new BrowserMenuBar(); menu.setUpdateMenuEnabled(options.isUpdateEnabled()); + menu.setLaunchGameMenuEnabled(options.isLaunchGameVisible()); // Registers menu as key event dispatcher to intercept Ctrl+Shift+D from any window KeyboardFocusManager.getCurrentKeyboardFocusManager().addKeyEventDispatcher(menu); setJMenuBar(menu); diff --git a/src/org/infinity/gui/BrowserMenuBar.java b/src/org/infinity/gui/BrowserMenuBar.java index 7a50cbc8c..93409d746 100644 --- a/src/org/infinity/gui/BrowserMenuBar.java +++ b/src/org/infinity/gui/BrowserMenuBar.java @@ -281,6 +281,11 @@ public void setUpdateMenuEnabled(boolean enable) { helpMenu.setUpdateMenuEnabled(enable); } + /** Specifies the enabled state of the "Allow launching games" entry in the Options menu. */ + public void setLaunchGameMenuEnabled(boolean enable) { + optionsMenu.optionLaunchGameAllowed.setEnabled(enable); + } + /** * Returns whether menu item "Tools > Print debug info" is shown. */ From 13c61352d2c262f8ebe501888f667ba932422203 Mon Sep 17 00:00:00 2001 From: Argent77 <4519923+Argent77@users.noreply.github.com> Date: Sat, 10 Jun 2023 14:59:53 +0200 Subject: [PATCH 3/3] Version 2.3-20230610 --- src/org/infinity/gui/BrowserMenuBar.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/org/infinity/gui/BrowserMenuBar.java b/src/org/infinity/gui/BrowserMenuBar.java index 93409d746..52e5ea9e4 100644 --- a/src/org/infinity/gui/BrowserMenuBar.java +++ b/src/org/infinity/gui/BrowserMenuBar.java @@ -117,7 +117,7 @@ import org.infinity.util.tuples.Couple; public final class BrowserMenuBar extends JMenuBar implements KeyEventDispatcher { - public static final String VERSION = "v2.3-20230609"; + public static final String VERSION = "v2.3-20230610"; public static final LookAndFeelInfo DEFAULT_LOOKFEEL = new LookAndFeelInfo("Metal", "javax.swing.plaf.metal.MetalLookAndFeel");