don't crash when rendering wrong nkInfix nodes

This commit is contained in:
Andreas Rumpf 2018-10-12 19:22:39 +02:00
commit dcc3ac74f4

View file

@ -1115,7 +1115,7 @@ proc gsub(g: var TSrcGen, n: PNode, c: TContext) =
infixArgument(g, n, 1) infixArgument(g, n, 1)
put(g, tkSpaces, Space) put(g, tkSpaces, Space)
gsub(g, n, 0) # binary operator gsub(g, n, 0) # binary operator
if not fits(g, lsub(g, n.sons[2]) + lsub(g, n.sons[0]) + 1): if n.len == 3 and not fits(g, lsub(g, n.sons[2]) + lsub(g, n.sons[0]) + 1):
optNL(g, g.indent + longIndentWid) optNL(g, g.indent + longIndentWid)
else: else:
put(g, tkSpaces, Space) put(g, tkSpaces, Space)