From 50426ea0fe058b1765afe10f0a853092b2a681cb Mon Sep 17 00:00:00 2001 From: LexManos Date: Tue, 27 Nov 2012 02:14:20 -0800 Subject: [PATCH] Fix potential NPE in saving a property that didn't define a type. --- common/net/minecraftforge/common/ConfigCategory.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/common/net/minecraftforge/common/ConfigCategory.java b/common/net/minecraftforge/common/ConfigCategory.java index 25822099a7..0e4ab437cd 100644 --- a/common/net/minecraftforge/common/ConfigCategory.java +++ b/common/net/minecraftforge/common/ConfigCategory.java @@ -150,8 +150,8 @@ public class ConfigCategory implements Map if (prop.isList()) { out.write(String.format(pad + "%s:%s <" + NEW_LINE, prop.getType().getID(), propName)); - pad = getIndent(indent + 2) -; + pad = getIndent(indent + 2); + for (String line : prop.valueList) { out.write(pad + line + NEW_LINE); @@ -159,6 +159,10 @@ public class ConfigCategory implements Map out.write(getIndent(indent + 1) + " >" + NEW_LINE); } + else if (prop.getType() == null) + { + out.write(String.format(pad + "%s=%s" + NEW_LINE, propName, prop.value)); + } else { out.write(String.format(pad + "%s:%s=%s" + NEW_LINE, prop.getType().getID(), propName, prop.value));