solver: check for input index existence

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
v0.9
Tonis Tiigi 2021-04-07 21:26:32 -07:00
parent df49b648c8
commit 86154daec1
1 changed files with 4 additions and 1 deletions

View File

@ -640,13 +640,16 @@ func (s *sharedOp) CalcSlowCache(ctx context.Context, index Index, p PreprocessF
}
if err := s.slowCacheErr[index]; err != nil {
s.slowMu.Unlock()
return err, nil
return nil, err
}
s.slowMu.Unlock()
complete := true
if p != nil {
st := s.st.solver.getState(s.st.vtx.Inputs()[index])
if st == nil {
return nil, errors.Errorf("failed to get state for index %d on %v", index, s.st.vtx.Name())
}
ctx2 := opentracing.ContextWithSpan(progress.WithProgress(ctx, st.mpw), st.mspan)
err = p(ctx2, res, st)
if err != nil {