From 597434eab992cd3f9495434ed6b990c8c491d66b Mon Sep 17 00:00:00 2001 From: Marian Buschsieweke Date: Mon, 3 Nov 2025 23:11:09 +0100 Subject: [PATCH] cmdebug: LoadSVD(): Fix exception in complete() The parameter `word` may actually be `None`, as shown by this exception: (gdb) svd_load STraceback (most recent call last): File "/usr/lib/python3.12/site-packages/cmdebug/svd_gdb.py", line 65, in complete prefix = word.lower() ^^^^^^^^^^ AttributeError: 'NoneType' object has no attribute 'lower' This lets prefix fall back to `""` in case word is `None` to fix the issue. --- cmdebug/svd_gdb.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cmdebug/svd_gdb.py b/cmdebug/svd_gdb.py index 4fb993b..c6e1e9c 100644 --- a/cmdebug/svd_gdb.py +++ b/cmdebug/svd_gdb.py @@ -62,11 +62,11 @@ def complete(self, text, word): # "svd_load " or "svd_load ST" if num_args == 1: - prefix = word.lower() + prefix = "" if word is None else word.lower() return [vendor for vendor in self.vendors if vendor.lower().startswith(prefix)] # "svd_load STMicro" or "svd_load STMicro STM32F1" elif num_args == 2 and args[0] in self.vendors: - prefix = word.lower() + prefix = "" if word is None else word.lower() filenames = self.vendors[args[0]] return [fname for fname in filenames if fname.lower().startswith(prefix)] return gdb.COMPLETE_NONE