Skip to content

Commit 84b2359

Browse files
committed
exec: check cdi manager not nil
Signed-off-by: CrazyMax <[email protected]>
1 parent 6702365 commit 84b2359

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

solver/llbsolver/ops/exec.go

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -199,16 +199,18 @@ func (e *ExecOp) CacheMap(ctx context.Context, g session.Group, index int) (*sol
199199
cm.Deps[i].PreprocessFunc = unlazyResultFunc
200200
}
201201

202-
for _, d := range e.op.CdiDevices {
203-
setup, ok := e.w.CDIManager().OnDemandInstaller(d.Name)
204-
if ok {
205-
prev := cm.Deps[0].PreprocessFunc
206-
cm.Deps[0].PreprocessFunc = func(ctx context.Context, r solver.Result, g session.Group) error {
207-
if err := prev(ctx, r, g); err != nil {
208-
return err
202+
if e.w != nil && e.w.CDIManager() != nil {
203+
for _, d := range e.op.CdiDevices {
204+
setup, ok := e.w.CDIManager().OnDemandInstaller(d.Name)
205+
if ok {
206+
prev := cm.Deps[0].PreprocessFunc
207+
cm.Deps[0].PreprocessFunc = func(ctx context.Context, r solver.Result, g session.Group) error {
208+
if err := prev(ctx, r, g); err != nil {
209+
return err
210+
}
211+
// we could pass glibc/musl type in here based on rootfs to get correct dynamic libs
212+
return setup(ctx)
209213
}
210-
// we could pass glibc/musl type in here based on rootfs to get correct dynamic libs
211-
return setup(ctx)
212214
}
213215
}
214216
}

0 commit comments

Comments
 (0)