From f5627254f7d786ebc47c7ed9220ee69e1b7f2dc4 Mon Sep 17 00:00:00 2001 From: Felix Krause Date: Thu, 7 Jan 2016 11:58:33 +0100 Subject: [PATCH] Fixed bug in presenter --- private/presenter.nim | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/private/presenter.nim b/private/presenter.nim index 1a709df..1a3c06a 100644 --- a/private/presenter.nim +++ b/private/presenter.nim @@ -253,7 +253,7 @@ proc present*(s: YamlStream, target: Stream, tagLib: YamlTagLibrary, nextState = if length <= 60: dFlowSequenceStart else: dBlockSequenceItem of ypsJson: - if levels[levels.high] in + if levels.len > 0 and levels[levels.high] in [dFlowImplicitMapStart, dFlowImplicitMapValue]: raise newException(YamlPresenterJsonError, "Cannot have sequence as map key in JSON output!") @@ -457,4 +457,4 @@ proc transform*(input: Stream, output: Stream, style: YamlPresentationStyle, tagLib = extendedTagLibrary() parser = newParser(tagLib) present(parser.parse(input), output, tagLib, style, - indentationStep) \ No newline at end of file + indentationStep)