From f41b93d94db5fe0c0dc505d8c519eb7f21262b72 Mon Sep 17 00:00:00 2001 From: Owain van Brakel Date: Sat, 30 Apr 2022 01:58:27 +0200 Subject: [PATCH] project(ClientUI): Fix NPE --- .../src/main/java/net/runelite/client/ui/ClientUI.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/runelite-client/src/main/java/net/runelite/client/ui/ClientUI.java b/runelite-client/src/main/java/net/runelite/client/ui/ClientUI.java index 6d20770373..385b6f2d69 100644 --- a/runelite-client/src/main/java/net/runelite/client/ui/ClientUI.java +++ b/runelite-client/src/main/java/net/runelite/client/ui/ClientUI.java @@ -1213,16 +1213,22 @@ public class ClientUI opacityField = Window.class.getDeclaredField("opacity"); opacityField.setAccessible(true); } + if (peerField == null) { peerField = Component.class.getDeclaredField("peer"); peerField.setAccessible(true); } + if (setOpacityMethod == null) { setOpacityMethod = Class.forName("java.awt.peer.WindowPeer").getDeclaredMethod("setOpacity", float.class); } + if (peerField.get(frame) == null) + { + return; + } final float opacity = Float.parseFloat(configManager.getConfiguration(OPENOSRS_CONFIG_GROUP, CONFIG_OPACITY_AMOUNT)) / 100F; assert opacity > 0F && opacity <= 1F : "I don't know who you are, I don't know why you tried, and I don't know how you tried, but this is NOT what you're supposed to do and you should honestly feel terrible about what you did, so I want you to take a nice long amount of time to think about what you just tried to do so you are not gonna do this in the future.";