Skip to content

Commit

Permalink
Add missing nil check for DPC when processing wwan status update
Browse files Browse the repository at this point in the history
DPC can be still nil when DPCManager receives the first status from
the wwan microservice. Without nil check, processWwanStatus function
may therefore hit the nil dereference panic.

Another small change in this commit is to avoid redundant calls
to currentDPC() - dpc is already retrieved at the beginning of the
function.

Signed-off-by: Milan Lenco <[email protected]>
(cherry picked from commit a984bcb)
  • Loading branch information
milan-zededa authored and eriknordmark committed Dec 7, 2024
1 parent a987c59 commit e25c566
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions pkg/pillar/dpcmanager/wwan.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,14 +76,14 @@ func (m *DpcManager) processWwanStatus(ctx context.Context, status types.WwanSta
}

if changed || wasInProgress {
if m.currentDPC() != nil {
changedDPC := m.setDiscoveredWwanIfNames(m.currentDPC())
if dpc != nil {
changedDPC := m.setDiscoveredWwanIfNames(dpc)
if changedDPC {
m.publishDPCL()
}
}
m.updateDNS()
if dpc.State == types.DPCStateWwanWait {
if dpc != nil && dpc.State == types.DPCStateWwanWait {
m.runVerify(ctx, "wwan status is up-to-date")
} else {
m.restartVerify(ctx, "wwan status changed")
Expand Down

0 comments on commit e25c566

Please sign in to comment.