From 8dc12193e305041c40c9220785466ac866d3963b Mon Sep 17 00:00:00 2001 From: KV Date: Sat, 2 May 2026 10:13:09 +0200 Subject: [PATCH 1/2] Fix the #497 bug Avoid string operation on a None gauge_unit value. --- src/wireviz/Harness.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/wireviz/Harness.py b/src/wireviz/Harness.py index c4af2364f..6dfc7b1dd 100644 --- a/src/wireviz/Harness.py +++ b/src/wireviz/Harness.py @@ -298,7 +298,7 @@ def create_graph(self) -> Graph: html = [] awg_fmt = "" - if cable.show_equiv: + if cable.gauge_unit and cable.show_equiv: # Only convert units we actually know about, i.e. currently # mm2 and awg --- other units _are_ technically allowed, # and passed through as-is. From 5c40ad451ac14013c5a511b251cf463332bd0032 Mon Sep 17 00:00:00 2001 From: KV Date: Sat, 2 May 2026 10:20:51 +0200 Subject: [PATCH 2/2] Check type of gauge_unit for a safer test --- src/wireviz/Harness.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/wireviz/Harness.py b/src/wireviz/Harness.py index 6dfc7b1dd..9933f9e9a 100644 --- a/src/wireviz/Harness.py +++ b/src/wireviz/Harness.py @@ -298,7 +298,7 @@ def create_graph(self) -> Graph: html = [] awg_fmt = "" - if cable.gauge_unit and cable.show_equiv: + if cable.show_equiv and isinstance(cable.gauge_unit, str): # Only convert units we actually know about, i.e. currently # mm2 and awg --- other units _are_ technically allowed, # and passed through as-is.