nil in string concats does not produce crashes anymore
This commit is contained in:
parent
c8a412998a
commit
7c538b26ad
3 changed files with 42 additions and 12 deletions
|
|
@ -1034,7 +1034,7 @@ proc genStrConcat(p: BProc, e: PNode, d: var TLoc) =
|
|||
if e.sons[i + 1].kind in {nkStrLit..nkTripleStrLit}:
|
||||
inc(L, len(e.sons[i + 1].strVal))
|
||||
else:
|
||||
addf(lens, "$1->$2 + ", [rdLoc(a), lenField(p)])
|
||||
addf(lens, "($1 ? $1->$2 : 0) + ", [rdLoc(a), lenField(p)])
|
||||
add(appends, rfmt(p.module, "#appendString($1, $2);$n", tmp.r, rdLoc(a)))
|
||||
linefmt(p, cpsStmts, "$1 = #rawNewString($2$3);$n", tmp.r, lens, rope(L))
|
||||
add(p.s(cpsStmts), appends)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue