Skip to content

Commit

Permalink
Add nil check for controller when agent is shutting down (#357)
Browse files Browse the repository at this point in the history
Add nil check for controller when agent is shutting down
  • Loading branch information
dhurley authored Jul 3, 2023
1 parent 1bd2513 commit 62e480f
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,10 @@ func handleSignals(
log.Errorf("Error sending AgentStopped event to command channel: %v", err)
}

if err := controller.Close(); err != nil {
log.Errorf("Unable to close controller: %v", err)
if controller != nil {
if err := controller.Close(); err != nil {
log.Warnf("Unable to close controller: %v", err)
}
}

log.Warn("NGINX Agent exiting")
Expand Down

0 comments on commit 62e480f

Please sign in to comment.