Skip to content

Commit 3440dc0

Browse files
committed
chore: prevent panics on invalid state input
1 parent 9953432 commit 3440dc0

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

pkg/engine/engine.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -331,6 +331,10 @@ func (e *Engine) complete(ctx context.Context, state *State) (*Return, error) {
331331
}
332332

333333
func (e *Engine) Continue(ctx Context, state *State, results ...CallResult) (*Return, error) {
334+
if state == nil {
335+
return nil, fmt.Errorf("invalid continue call, missing state")
336+
}
337+
334338
var added bool
335339

336340
state = &State{

pkg/runner/runner.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -479,6 +479,10 @@ func (r *Runner) resume(callCtx engine.Context, monitor Monitor, env []string, s
479479
return nil, fmt.Errorf("invalid state, resume should not have StartContinuation set to true")
480480
}
481481

482+
if state.Continuation == nil {
483+
return nil, errors.New("invalid state, resume should have Continuation data")
484+
}
485+
482486
progress, progressClose := streamProgress(&callCtx, monitor)
483487
defer progressClose()
484488

0 commit comments

Comments
 (0)