net/portmapper: fix nil pointer dereference in Client.createMapping

The EventBus in net/portmapper.Config is still optional and Client.updates can be nil.

Updates #15772

Signed-off-by: Nick Khyl <nickk@tailscale.com>
This commit is contained in:
Nick Khyl 2025-04-23 09:35:14 -05:00 committed by Nick Khyl
parent c28fda864a
commit c41a2d5c83

View File

@ -508,11 +508,13 @@ func (c *Client) createMapping() {
}
return
}
if c.updates != nil {
c.updates.Publish(Mapping{
External: mapping.External(),
Type: mapping.MappingType(),
GoodUntil: mapping.GoodUntil(),
})
}
if c.onChange != nil {
go c.onChange()
}