From 1a31fd00b6bf9994086d893215c8589b5d63cc76 Mon Sep 17 00:00:00 2001 From: Graham McIntire Date: Wed, 11 Feb 2026 12:28:58 -0600 Subject: [PATCH] fix nil sysDescr crashing vendor identification String.contains?/2 crashes on nil input. default nil sysDescr and sysObjectID to empty string in find_vendor_match. --- lib/towerops/snmp/profiles/base.ex | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/towerops/snmp/profiles/base.ex b/lib/towerops/snmp/profiles/base.ex index 83c32cc2..0dd85ec2 100644 --- a/lib/towerops/snmp/profiles/base.ex +++ b/lib/towerops/snmp/profiles/base.ex @@ -1346,6 +1346,9 @@ defmodule Towerops.Snmp.Profiles.Base do end defp find_vendor_match(sys_descr, sys_object_id) do + sys_descr = sys_descr || "" + sys_object_id = sys_object_id || "" + Enum.find_value(@vendor_patterns, fn {descr_patterns, oid_patterns, manufacturer, extractor} -> descr_match = descr_patterns != [] and String.contains?(sys_descr, descr_patterns) oid_match = oid_patterns != [] and String.contains?(sys_object_id, oid_patterns)