diff options
| author | bculkin2442 <bjculkin@mix.wvu.edu> | 2016-04-03 18:43:50 -0400 |
|---|---|---|
| committer | bculkin2442 <bjculkin@mix.wvu.edu> | 2016-04-03 18:43:50 -0400 |
| commit | 9658afb5b07d2b5a965dea322b0ad8fa3c16ce2d (patch) | |
| tree | f9e50750e1a0d04f0c84ef9177bb5f7ae9050dc8 /dice-lang/src/main/java/bjc/dicelang/ComplexDice.java | |
| parent | c8ae1ec096f5d1ac6db4f3a0035f7da106444e4e (diff) | |
More refactoring and maintenance
Diffstat (limited to 'dice-lang/src/main/java/bjc/dicelang/ComplexDice.java')
| -rw-r--r-- | dice-lang/src/main/java/bjc/dicelang/ComplexDice.java | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/dice-lang/src/main/java/bjc/dicelang/ComplexDice.java b/dice-lang/src/main/java/bjc/dicelang/ComplexDice.java index 5d88001..054c73b 100644 --- a/dice-lang/src/main/java/bjc/dicelang/ComplexDice.java +++ b/dice-lang/src/main/java/bjc/dicelang/ComplexDice.java @@ -89,6 +89,12 @@ public class ComplexDice implements IDiceExpression { */ int nRoll = nDice.roll(); + if (nRoll < 0) { + throw new UnsupportedOperationException( + "Attempted to roll a negative number of dice. " + + "The problematic expression is " + nDice); + } + for (int i = 0; i < nRoll; i++) { res += die.roll(); } @@ -110,4 +116,4 @@ public class ComplexDice implements IDiceExpression { + die.toString() + "]"; } } -} +}
\ No newline at end of file |
