From 5c00abf655528954224e383695d452ec8645ba3b Mon Sep 17 00:00:00 2001 From: acrylic-style Date: Mon, 18 Apr 2022 12:39:27 +0900 Subject: [PATCH] Fix NPE in toString method --- build.gradle.kts | 2 +- .../azisaba/azipluginmessaging/spigot/entity/PlayerImpl.java | 4 ++-- .../velocity/server/ServerConnectionImpl.java | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index 04c454f..ce48c43 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -6,7 +6,7 @@ plugins { } group = "net.azisaba.azipluginmessaging" -version = "2.1.2" +version = "2.1.3" repositories { mavenCentral() diff --git a/spigot/src/main/java/net/azisaba/azipluginmessaging/spigot/entity/PlayerImpl.java b/spigot/src/main/java/net/azisaba/azipluginmessaging/spigot/entity/PlayerImpl.java index bb57c36..74a333a 100644 --- a/spigot/src/main/java/net/azisaba/azipluginmessaging/spigot/entity/PlayerImpl.java +++ b/spigot/src/main/java/net/azisaba/azipluginmessaging/spigot/entity/PlayerImpl.java @@ -116,8 +116,8 @@ public boolean isChallengeEquals(@NotNull String challenge) { public String toString() { return "PlayerImpl{" + "handle=" + handle + - ", publicKey=" + EncryptionUtil.encodePublicKey(keyPair.getPublic()) + - ", remotePublicKey=" + EncryptionUtil.encodePublicKey(remotePublicKey) + + ", publicKey=" + (keyPair == null ? null : EncryptionUtil.encodePublicKey(keyPair.getPublic())) + + ", remotePublicKey=" + (remotePublicKey == null ? null : EncryptionUtil.encodePublicKey(remotePublicKey)) + ", encrypted=" + encrypted + '}'; } diff --git a/velocity/src/main/java/net/azisaba/azipluginmessaging/velocity/server/ServerConnectionImpl.java b/velocity/src/main/java/net/azisaba/azipluginmessaging/velocity/server/ServerConnectionImpl.java index b7a3cb1..72eefe0 100644 --- a/velocity/src/main/java/net/azisaba/azipluginmessaging/velocity/server/ServerConnectionImpl.java +++ b/velocity/src/main/java/net/azisaba/azipluginmessaging/velocity/server/ServerConnectionImpl.java @@ -112,8 +112,8 @@ public String toString() { return "ServerConnectionImpl{" + "handle=" + handle + ", encrypted=" + encrypted + - ", publicKey=" + EncryptionUtil.encodePublicKey(keyPair.getPublic()) + - ", remotePublicKey=" + EncryptionUtil.encodePublicKey(publicKey) + + ", publicKey=" + (keyPair == null ? null : EncryptionUtil.encodePublicKey(keyPair.getPublic())) + + ", remotePublicKey=" + (publicKey == null ? null : EncryptionUtil.encodePublicKey(publicKey)) + '}'; } }