NOISSUE - Fix nil pointer dereference in Stop methods for agentServer and agentService (#409)
CI / checkproto (push) Has been cancelled
CI / ci (push) Has been cancelled

Signed-off-by: Sammy Oina <sammyoina@gmail.com>
This commit is contained in:
Sammy Kerata Oina
2025-03-19 13:44:21 +03:00
committed by GitHub
parent 3fe7507529
commit ebe119686f
2 changed files with 7 additions and 2 deletions
+3
View File
@@ -94,5 +94,8 @@ func (as *agentServer) Start(cfg agent.AgentConfig, cmp agent.Computation) error
}
func (as *agentServer) Stop() error {
if as.gs == nil {
return nil
}
return as.gs.Stop()
}
+4 -2
View File
@@ -215,8 +215,10 @@ func (as *agentService) StopComputation(ctx context.Context) error {
as.cancel()
if err := as.algorithm.Stop(); err != nil {
return fmt.Errorf("error stopping computation: %v", err)
if as.algorithm != nil {
if err := as.algorithm.Stop(); err != nil {
return fmt.Errorf("error stopping computation: %v", err)
}
}
sm := statemachine.NewStateMachine(Idle)