this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

tools/trim: prevent nil-pointer panic

Fixes #1087

Change-Id: I471969c6f75361e39f706083eb23a0b005be92ad
Signed-off-by: Marcel van Lohuizen <mpvl@golang.org>
Reviewed-on: https://review.gerrithub.io/c/cue-lang/cue/+/532314
Unity-Result: CUEcueckoo <cueckoo@cuelang.org>
TryBot-Result: CUEcueckoo <cueckoo@cuelang.org>
Reviewed-by: Marcel van Lohuizen <mpvl@gmail.com>

authored by

Marcel van Lohuizen and committed by
Marcel van Lohuizen
6bc922c8 9aeaf704

+29 -1
+28
tools/trim/testdata/issue1087.txtar
··· 1 + #Issue: 1087 2 + -- in.cue -- 3 + configs: { 4 + key: 123 5 + } 6 + 7 + shared: { 8 + param: string 9 + derived: configs[param] 10 + } 11 + 12 + a: shared & { 13 + param: "key" 14 + } 15 + -- out/trim -- 16 + == in.cue 17 + configs: { 18 + key: 123 19 + } 20 + 21 + shared: { 22 + param: string 23 + derived: configs[param] 24 + } 25 + 26 + a: shared & { 27 + param: "key" 28 + }
+1 -1
tools/trim/trim.go
··· 216 216 if r, ok := c.Expr().(adt.Resolver); ok { 217 217 x, _ := t.ctx.Resolve(c.Env, r) 218 218 // Even if this is not a dominator now, descendants will be. 219 - if x.Label.IsDef() { 219 + if x != nil && x.Label.IsDef() { 220 220 for _, c := range x.Conjuncts { 221 221 doms.AddConjunct(c) 222 222 }