mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-22 20:12:00 -06:00
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.
This commit is contained in:
parent
a021d29280
commit
5114424d88
@ -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."
|
||||
|
Loading…
Reference in New Issue
Block a user