Fix crash when scarpet rules are set permanently

Fixes #1562
This commit is contained in:
altrisi authored and GitHub committed 2022-10-05 10:21:07 +02:00
1 parent 4f9bd3ab78
commit 24385f28c2
1 file changed
+1 -1
@@ -329,7 +329,7 @@ public class SettingsManager {
private void switchScarpetRuleIfNeeded(CommandSourceStack source, CarpetRule<?> carpetRule) //TODO remove. This should be handled by the rule
{
if (carpetRule instanceof ParsedRule<?> rule && !rule.scarpetApp.isEmpty())
if (carpetRule instanceof ParsedRule<?> rule && !rule.scarpetApp.isEmpty() && CarpetServer.scriptServer != null) // null check because we may be in server init
{
if (RuleHelper.getBooleanValue(rule) || (rule.type() == String.class && !rule.value().equals("false")))
{