Fix NPE from config fixers

Related: #174
This commit is contained in:
embeddedt 2023-07-22 09:56:25 -04:00
parent edb3da4f74
commit 18cec4f88d
No known key found for this signature in database
GPG Key ID: A69433EC199B5613
2 changed files with 4 additions and 1 deletions

View File

@ -50,7 +50,8 @@ public class ConfigFixer {
this.actualHandler.accept(modConfigEvent);
}
} else {
ModernFix.LOGGER.warn("Unable to sync on a {} config object", modConfigEvent.getConfig().getConfigData().getClass().getName());
if(modConfigEvent.getConfig().getConfigData() != null)
ModernFix.LOGGER.warn("Unable to sync on a {} config object", modConfigEvent.getConfig().getConfigData().getClass().getName());
this.actualHandler.accept(modConfigEvent);
}
}

View File

@ -85,6 +85,8 @@ public class NightConfigFixer {
private static final Set<Class<?>> UNKNOWN_FILE_CONFIG_CLASSES = Collections.synchronizedSet(new ReferenceOpenHashSet<>());
public static Object toWriteSyncConfig(Object config) {
if(config == null)
return null;
try {
if(WRITE_SYNC_CONFIG.isAssignableFrom(config.getClass())) {
return config;