summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/json/ext/GeneratorState.java1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/json/ext/GeneratorState.java b/src/json/ext/GeneratorState.java
index 7d6013b..90d30e4 100644
--- a/src/json/ext/GeneratorState.java
+++ b/src/json/ext/GeneratorState.java
@@ -466,6 +466,7 @@ public class GeneratorState extends RubyObject {
*/
private void checkMaxNesting() {
if (maxNesting != 0 && depth > maxNesting) {
+ depth--;
throw Utils.newException(getRuntime().getCurrentContext(),
Utils.M_NESTING_ERROR, "nesting of " + depth + " is too deep");
}