From 308cc50afaad8393890aaaa8666dd8ea7848bedc Mon Sep 17 00:00:00 2001 From: Bukkit/Spigot Date: Mon, 6 Dec 2021 07:22:16 +1100 Subject: [PATCH] #687: Fix NPE from previous commits By: Wolf2323 --- .../main/java/org/bukkit/configuration/MemorySection.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/paper-api/src/main/java/org/bukkit/configuration/MemorySection.java b/paper-api/src/main/java/org/bukkit/configuration/MemorySection.java index 09f1debef5..a6ac5d4534 100644 --- a/paper-api/src/main/java/org/bukkit/configuration/MemorySection.java +++ b/paper-api/src/main/java/org/bukkit/configuration/MemorySection.java @@ -251,10 +251,14 @@ public class MemorySection implements ConfigurationSection { int i1 = -1, i2; ConfigurationSection section = this; while ((i1 = path.indexOf(separator, i2 = i1 + 1)) != -1) { - if (section == null || !section.contains(path.substring(i2, i1), true)) { + final String currentPath = path.substring(i2, i1); + if (!section.contains(currentPath, true)) { + return def; + } + section = section.getConfigurationSection(currentPath); + if (section == null) { return def; } - section = section.getConfigurationSection(path.substring(i2, i1)); } String key = path.substring(i2);