File tree Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -2528,12 +2528,20 @@ const (
25282528
25292529// RestoreStackFromContext returns the stack to be used during restore.
25302530func RestoreStackFromContext (ctx context.Context ) * Stack {
2531- return ctx .Value (CtxRestoreStack ).(* Stack )
2531+ if st := ctx .Value (CtxRestoreStack ); st != nil {
2532+ return st .(* Stack )
2533+ }
2534+ return nil
25322535}
25332536
25342537// ResumeStackFromContext returns the stack to be used during restore.
25352538func ResumeStackFromContext (ctx context.Context ) bool {
2536- return ctx .Value (CtxResumeStack ).(bool )
2539+ // If we are resuming, the context should have a value set to true. If
2540+ // restoring it will be false or not exist.
2541+ if resume := ctx .Value (CtxResumeStack ); resume != nil {
2542+ return resume .(bool )
2543+ }
2544+ return false
25372545}
25382546
25392547// SetRemoveNICs sets the removeNICs in stack to true during save/restore.
You can’t perform that action at this time.
0 commit comments