From 8e0fad599e9750cb07875b09b4cdebd1f94d4d9f Mon Sep 17 00:00:00 2001 From: Graham McIntire Date: Wed, 4 Feb 2026 18:09:36 -0600 Subject: [PATCH] fix: handle nil site in list_neighbors_with_equipment Fixes BadMapError when loading device show page for devices without an assigned site. Changed to use device.organization_id directly instead of device.site.organization_id since site can be nil but organization is always present. --- lib/towerops/snmp.ex | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/towerops/snmp.ex b/lib/towerops/snmp.ex index 1c82cc22..e555fb03 100644 --- a/lib/towerops/snmp.ex +++ b/lib/towerops/snmp.ex @@ -399,7 +399,7 @@ defmodule Towerops.Snmp do device = Towerops.Devices.get_device!(device_id) Enum.map(neighbors, fn neighbor -> - matched_device = find_matching_equipment(neighbor, device.site.organization_id) + matched_device = find_matching_equipment(neighbor, device.organization_id) Map.put(neighbor, :matched_device, matched_device) end) end