Skip to content

Commit e724c0c

Browse files
committed
fix nil access while polling controllable task for STANDBY state
1 parent 24dae4b commit e724c0c

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

executor/executable/controllabletask.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -447,6 +447,7 @@ func (t *ControllableTask) pollTaskForStandbyState() error {
447447
Debug("polling task for STANDBY state reached")
448448

449449
response, err := t.rpc.GetState(context.TODO(), &pb.GetStateRequest{}, grpc.EmptyCallOption{})
450+
reachedState := "UNKNOWN"
450451
if err != nil {
451452
log.WithError(err).
452453
WithFields(defaultLogFields).
@@ -458,12 +459,11 @@ func (t *ControllableTask) pollTaskForStandbyState() error {
458459
WithField(infologger.Level, infologger.IL_Devel).
459460
Debug("task status queried")
460461
t.knownPid = int(response.GetPid())
462+
// NOTE: we acquire the transitioner-dependent STANDBY equivalent state
463+
reachedState = t.rpc.FromDeviceState(response.GetState())
461464
}
462-
// NOTE: we acquire the transitioner-dependent STANDBY equivalent state
463-
// fixme: that's a possible nil access there, because we do not "continue" on error
464-
reachedState := t.rpc.FromDeviceState(response.GetState())
465465

466-
if reachedState == "STANDBY" && err == nil {
466+
if reachedState == "STANDBY" {
467467
log.WithFields(defaultLogFields).
468468
WithField(infologger.Level, infologger.IL_Devel).
469469
Debug("task running and ready for control input")

0 commit comments

Comments
 (0)