Skip to content

Commit

Permalink
fix: possible panic in Headscale.scheduledDERPMapUpdateWorker
Browse files Browse the repository at this point in the history
There is a possible nil pointer dereference panic in the
`Headscale.scheduledDERPMapUpdateWorker`. Such as when the embedded
DERP server is disabled.
  • Loading branch information
aofei committed Mar 18, 2022
1 parent 1c9b1c0 commit 1eafe96
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion derp.go
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,9 @@ func (h *Headscale) scheduledDERPMapUpdateWorker(cancelChan <-chan struct{}) {
case <-ticker.C:
log.Info().Msg("Fetching DERPMap updates")
h.DERPMap = GetDERPMap(h.cfg.DERP)
h.DERPMap.Regions[h.DERPServer.region.RegionID] = &h.DERPServer.region
if h.cfg.DERP.ServerEnabled {
h.DERPMap.Regions[h.DERPServer.region.RegionID] = &h.DERPServer.region
}

namespaces, err := h.ListNamespaces()
if err != nil {
Expand Down

0 comments on commit 1eafe96

Please sign in to comment.