From c0d1e0fb343bfe93ca0de7a74947b93d116ecf03 Mon Sep 17 00:00:00 2001 From: David Polverari Date: Fri, 8 May 2026 22:06:17 -0300 Subject: [PATCH] Fix 'NoneType' object not subscriptable --- pathfinder.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pathfinder.py b/pathfinder.py index 3081325..d30ef6b 100644 --- a/pathfinder.py +++ b/pathfinder.py @@ -63,7 +63,9 @@ def processNmapFile(inputNmapXmlFile, outputDotPngFile, skipDestHost, destIpToNe hops = run.trace.hop # check if last hop equals to target host (else skip due to incomplete traceroute) - if run.address["addr"] != hops[len(hops)-1]["ipaddr"]: + last_hop = hops[-1] if hops else None + + if run.address and last_hop and run.address["addr"] != last_hop["ipaddr"]: print(" Incomplete traceroute for host") continue