lib/nat: Don't crash on empty address list (fixes #9503) (#9504)

This commit is contained in:
Jakob Borg 2024-04-11 13:23:29 +02:00 committed by GitHub
parent 61b94b9ea5
commit 79ae24df76
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -233,9 +233,8 @@ func (s *Service) verifyExistingLocked(ctx context.Context, mapping *Mapping, na
default:
}
// Delete addresses for NATDevice's that do not exist anymore
nat, ok := nats[id]
if !ok {
if nat, ok := nats[id]; !ok || len(extAddrs) == 0 {
// Delete addresses for NATDevice's that do not exist anymore
mapping.removeAddressLocked(id)
change = true
continue