diff options
author | LemonBoy <LemonBoy@users.noreply.github.com> | 2018-10-22 17:09:15 +0200 |
---|---|---|
committer | Andreas Rumpf <rumpf_a@web.de> | 2018-10-22 17:09:15 +0200 |
commit | b613092de8b4b4625c8a2e8b29d64c5a8e49287e (patch) | |
tree | e2d1255475a9000b2675dca18aef54ba1c3ff972 /compiler | |
parent | 9c88df220a3fb871a9d3fecf7623e27c0fa35667 (diff) | |
download | Nim-b613092de8b4b4625c8a2e8b29d64c5a8e49287e.tar.gz |
Don't crash if GC_{un,}ref is called on nil (#9445)
Fixes #9442
Diffstat (limited to 'compiler')
-rw-r--r-- | compiler/ccgexprs.nim | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/compiler/ccgexprs.nim b/compiler/ccgexprs.nim index d73dac82f..44967961e 100644 --- a/compiler/ccgexprs.nim +++ b/compiler/ccgexprs.nim @@ -2008,8 +2008,8 @@ proc genMagicExpr(p: BProc, e: PNode, d: var TLoc, op: TMagic) = frmt = "$1 = $2->len;$n" lineCg(p, cpsStmts, frmt, tmp.r, rdLoc(a)) putIntoDest(p, d, e, tmp.r) - of mGCref: unaryStmt(p, e, d, "#nimGCref($1);$n") - of mGCunref: unaryStmt(p, e, d, "#nimGCunref($1);$n") + of mGCref: unaryStmt(p, e, d, "if ($1) { #nimGCref($1); }$n") + of mGCunref: unaryStmt(p, e, d, "if ($1) { #nimGCunref($1); }$n") of mSetLengthStr: genSetLengthStr(p, e, d) of mSetLengthSeq: genSetLengthSeq(p, e, d) of mIncl, mExcl, mCard, mLtSet, mLeSet, mEqSet, mMulSet, mPlusSet, mMinusSet, |