From b4192fd8e66604c5edcc4a7c9692107991962c7b Mon Sep 17 00:00:00 2001 From: Gabriel Wolf Date: Sun, 5 Dec 2021 14:36:47 +0000 Subject: [PATCH] fix NPE from changes in e4358b82171 --- ...-fix-NPE-from-changes-in-e4358b82171.patch | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 patches/api/0346-fix-NPE-from-changes-in-e4358b82171.patch diff --git a/patches/api/0346-fix-NPE-from-changes-in-e4358b82171.patch b/patches/api/0346-fix-NPE-from-changes-in-e4358b82171.patch new file mode 100644 index 000000000..c8a90b8b3 --- /dev/null +++ b/patches/api/0346-fix-NPE-from-changes-in-e4358b82171.patch @@ -0,0 +1,24 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Gabriel Wolf +Date: Sun, 5 Dec 2021 14:36:05 +0000 +Subject: [PATCH] fix NPE from changes in e4358b82171 + + +diff --git a/src/main/java/org/bukkit/configuration/MemorySection.java b/src/main/java/org/bukkit/configuration/MemorySection.java +index 09f1debef5fad469a05a0d97b740a7310890fd64..9949fdd139709b42f8e3321b155c6980b177c2a4 100644 +--- a/src/main/java/org/bukkit/configuration/MemorySection.java ++++ b/src/main/java/org/bukkit/configuration/MemorySection.java +@@ -251,7 +251,12 @@ 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));