From 25a944baf4001e2d59f01fcac359fb51a0e46dd9 Mon Sep 17 00:00:00 2001 From: JeremyStarTM Date: Tue, 15 Oct 2024 04:06:31 +0200 Subject: [PATCH] Fix null value crash --- .../windowing/glfw/implementable/GlfwWindow.java | 6 +++--- .../engine/windowing/implementable/Window.java | 10 +++++----- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/windowing/glfw/src/main/java/de/staropensource/engine/windowing/glfw/implementable/GlfwWindow.java b/windowing/glfw/src/main/java/de/staropensource/engine/windowing/glfw/implementable/GlfwWindow.java index 3933022c..84b87604 100644 --- a/windowing/glfw/src/main/java/de/staropensource/engine/windowing/glfw/implementable/GlfwWindow.java +++ b/windowing/glfw/src/main/java/de/staropensource/engine/windowing/glfw/implementable/GlfwWindow.java @@ -109,14 +109,14 @@ public final class GlfwWindow extends Window { * @throws Exception stuff thrown by the {@link #initializeWindow()} and {@link #render()} methods of the implementing windowing API * @since v1-alpha2 */ - public GlfwWindow(@NotNull String name, @NotNull String title, @NotNull Path @Nullable [] icons, @NotNull Vec2i size, @NotNull Vec2i minimumSize, @NotNull Vec2i maximumSize, @NotNull Vec2i position, @NotNull WindowMode windowMode, @NotNull Monitor monitor, boolean resizable, boolean borderless, boolean focusable, boolean onTop, boolean transparent, boolean rendering) throws Exception { + public GlfwWindow(@NotNull String name, @NotNull String title, @Nullable Path @NotNull [] icons, @NotNull Vec2i size, @NotNull Vec2i minimumSize, @NotNull Vec2i maximumSize, @NotNull Vec2i position, @NotNull WindowMode windowMode, @NotNull Monitor monitor, boolean resizable, boolean borderless, boolean focusable, boolean onTop, boolean transparent, boolean rendering) throws Exception { super(name, title, icons, size, minimumSize, maximumSize, position, windowMode, monitor, resizable, borderless, focusable, onTop, transparent, rendering); } /** {@inheritDoc} */ @Override protected void initializeWindow() { - createGlfwWindow(); // Create the GLFW window + createGlfwWindow(); } /** @@ -356,7 +356,7 @@ public final class GlfwWindow extends Window { /** {@inheritDoc} */ @ApiStatus.Experimental @Override - public void setIcons(@NotNull Path @Nullable [] icons) { + public void setIcons(@Nullable Path @NotNull [] icons) { getLogger().warn("GlfwWindow#setIcons is experimental and may cause engine or JVM crashes. Here be dragons!"); // Ensure the window is not terminated diff --git a/windowing/src/main/java/de/staropensource/engine/windowing/implementable/Window.java b/windowing/src/main/java/de/staropensource/engine/windowing/implementable/Window.java index 7d4fd3a1..cd057428 100644 --- a/windowing/src/main/java/de/staropensource/engine/windowing/implementable/Window.java +++ b/windowing/src/main/java/de/staropensource/engine/windowing/implementable/Window.java @@ -222,7 +222,7 @@ public abstract class Window implements AutoCloseable { * @since v1-alpha6 */ @Setter - private @NotNull Path @Nullable [] icons; + private @Nullable Path @NotNull [] icons; /** * Contains the size of this window. @@ -508,7 +508,7 @@ public abstract class Window implements AutoCloseable { * @throws Exception stuff thrown by the {@link #initializeWindow()} and {@link #render()} methods of the implementing windowing API * @since v1-alpha2 */ - protected Window(@NotNull String name, @NotNull String title, @NotNull Path @Nullable [] icons, @NotNull Vec2i size, @NotNull Vec2i minimumSize, @NotNull Vec2i maximumSize, @NotNull Vec2i position, @NotNull WindowMode windowMode, @NotNull Monitor monitor, boolean resizable, boolean borderless, boolean focusable, boolean onTop, boolean transparent, boolean rendering) throws Exception { + protected Window(@NotNull String name, @NotNull String title, @Nullable Path @NotNull [] icons, @NotNull Vec2i size, @NotNull Vec2i minimumSize, @NotNull Vec2i maximumSize, @NotNull Vec2i position, @NotNull WindowMode windowMode, @NotNull Monitor monitor, boolean resizable, boolean borderless, boolean focusable, boolean onTop, boolean transparent, boolean rendering) throws Exception { // Initialize variables this.uniqueIdentifier = UUID.randomUUID(); this.name = name; @@ -657,7 +657,7 @@ public abstract class Window implements AutoCloseable { * @see Window#icons * @since v1-alpha6 */ - private @NotNull Path @Nullable [] icons = null; + private @Nullable Path @NotNull [] icons = null; /** * Contains the window size. @@ -849,7 +849,7 @@ public abstract class Window implements AutoCloseable { * @see Window#icons * @since v1-alpha6 */ - public @NotNull Path @Nullable [] getIcons() { + public @Nullable Path @NotNull [] getIcons() { return icons; } @@ -1020,7 +1020,7 @@ public abstract class Window implements AutoCloseable { * @see Window#icons * @since v1-alpha6 */ - public @NotNull Builder setIcons(@NotNull Path @Nullable [] icons) { + public @NotNull Builder setIcons(@Nullable Path @NotNull [] icons) { this.icons = icons; return this; }