From 7fd76962f2c97f993a209a54243388b09f154249 Mon Sep 17 00:00:00 2001 From: Andrew Steinborn Date: Sat, 27 Jun 2020 23:03:47 -0400 Subject: [PATCH] Graceful fallback if these values are absent --- .../velocitypowered/proxy/config/VelocityConfiguration.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/proxy/src/main/java/com/velocitypowered/proxy/config/VelocityConfiguration.java b/proxy/src/main/java/com/velocitypowered/proxy/config/VelocityConfiguration.java index 79e4c2d2b..a6d25c897 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/config/VelocityConfiguration.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/config/VelocityConfiguration.java @@ -383,14 +383,14 @@ public class VelocityConfiguration implements ProxyConfig { // Handle any cases where the config needs to be saved again byte[] forwardingSecret; String forwardingSecretString = config.get("forwarding-secret"); - if (forwardingSecretString.isEmpty()) { + if (forwardingSecretString == null || forwardingSecretString.isEmpty()) { forwardingSecretString = generateRandomString(12); config.set("forwarding-secret", forwardingSecretString); mustResave = true; } forwardingSecret = forwardingSecretString.getBytes(StandardCharsets.UTF_8); - if (config.get("metrics.id").isEmpty()) { + if (!config.contains("metrics.id") || config.get("metrics.id").isEmpty()) { config.set("metrics.id", UUID.randomUUID().toString()); mustResave = true; }