Skip to content

Commit

Permalink
Subtle pointer checks (#1433)
Browse files Browse the repository at this point in the history
  • Loading branch information
joel-rieke authored Jan 16, 2025
1 parent 233fd91 commit fab19fe
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions pkg/core/util/hive/kernelcr.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ func (pH *PluginHandler) DynamicReloader(driverConfig *config.DriverConfig) {
}
if valid {
for s, sPh := range *pH.Services {
if sPh.ConfigContext != nil && *sPh.ConfigContext.CmdSenderChan != nil {
if sPh != nil && sPh.ConfigContext != nil && (*sPh.ConfigContext).CmdSenderChan != nil {
*sPh.ConfigContext.CmdSenderChan <- core.KernelCmd{
PluginName: sPh.Name,
Command: core.PLUGIN_EVENT_STOP,
Expand Down Expand Up @@ -175,7 +175,7 @@ func (pH *PluginHandler) DynamicReloader(driverConfig *config.DriverConfig) {
if new_sha, ok := certifyMap["trcsha256"]; ok && new_sha.(string) != servPh.Signature {
driverConfig.CoreConfig.Log.Printf("Kernel shutdown, installing new service: %s\n", service)
for s, sPh := range *pH.Services {
if sPh.ConfigContext != nil && *sPh.ConfigContext.CmdSenderChan != nil {
if sPh != nil && sPh.ConfigContext != nil && (*sPh.ConfigContext).CmdSenderChan != nil {
*sPh.ConfigContext.CmdSenderChan <- core.KernelCmd{
PluginName: sPh.Name,
Command: core.PLUGIN_EVENT_STOP,
Expand All @@ -188,7 +188,7 @@ func (pH *PluginHandler) DynamicReloader(driverConfig *config.DriverConfig) {
}

if t, ok := certifyMap["trctype"]; ok && t.(string) == "trcshkubeservice" {
if servPh.ConfigContext == nil || *servPh.ConfigContext.CmdSenderChan == nil {
if servPh != nil && servPh.ConfigContext == nil || (*servPh.ConfigContext).CmdSenderChan == nil {
driverConfig.CoreConfig.Log.Printf("Kube service not properly initialized to shut down: %s\n", service)
goto waitToReload
}
Expand Down

0 comments on commit fab19fe

Please sign in to comment.