From 5114424d88b129f17b17cddee0c7bc815afaef98 Mon Sep 17 00:00:00 2001 From: Martin Hauser Date: Wed, 11 Jun 2025 16:07:12 +0200 Subject: [PATCH] fix(wireless): Add null checks for WirelessLink interface validation Adds checks for the presence of `interface_a` and `interface_b` to avoid attribute errors during WirelessLink validation. Ensures robust handling of edge cases where the attributes may be missing. --- netbox/wireless/models.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/netbox/wireless/models.py b/netbox/wireless/models.py index 9c73ae5b7..11f9e06eb 100644 --- a/netbox/wireless/models.py +++ b/netbox/wireless/models.py @@ -198,13 +198,13 @@ class WirelessLink(WirelessAuthenticationBase, DistanceMixin, PrimaryModel): super().clean() # Validate interface types - if self.interface_a.type not in WIRELESS_IFACE_TYPES: + if hasattr(self, "interface_a") and self.interface_a.type not in WIRELESS_IFACE_TYPES: raise ValidationError({ 'interface_a': _( "{type} is not a wireless interface." ).format(type=self.interface_a.get_type_display()) }) - if self.interface_b.type not in WIRELESS_IFACE_TYPES: + if hasattr(self, "interface_b") and self.interface_b.type not in WIRELESS_IFACE_TYPES: raise ValidationError({ 'interface_b': _( "{type} is not a wireless interface."