Skip to content

Commit

Permalink
Add error message when using state modifiers without a state provider.
Browse files Browse the repository at this point in the history
  • Loading branch information
homothetyhk committed Mar 2, 2024
1 parent 6cbd34d commit 69e3bee
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions RandomizerCore/Logic/DNFLogicDefBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,10 @@ DNFLogicDef.StatePath[] CreateClauses(DNFLogicDef parent)
}
#endif
}
if (paths.Any(p => p.stateProvider is null && p.stateModifiers.Length > 0))
{
throw new ArgumentException("Found state modifiers without an associated state provider.");
}

return paths;
}
Expand Down Expand Up @@ -138,6 +142,7 @@ private void ExpandToken(int index)
break;
case CoalescingToken qt:
tokens[index] = IsValidToken(qt.Left) ? qt.Left : qt.Right;
ExpandToken(index);
break;
}
}
Expand Down

0 comments on commit 69e3bee

Please sign in to comment.