aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTeddy Wing2023-08-08 20:07:33 +0200
committerTeddy Wing2023-08-08 20:07:33 +0200
commit9d57acc86a01bd3875bcc888a7b6e21128944a93 (patch)
treedc3e2af75060218d810b90fd41cd9d93f20daeaa
parent71770f3e23f7a3a54ef29b53d8fce9982a8221cf (diff)
downloadcws-status-9d57acc86a01bd3875bcc888a7b6e21128944a93.tar.bz2
cws-status: Fix out of bounds error on `item_statuses`
In some cases, `item_statuses` can be shorter than `item_names_versions`. I didn't look into why, just decided to add a quick fix for the bounds error so the program could keep working again without crashing. This seems to fix the problem I had, but it may need to be revisited further down the line.
-rw-r--r--cws-status7
1 files changed, 5 insertions, 2 deletions
diff --git a/cws-status b/cws-status
index 2a26421..02d4a7f 100644
--- a/cws-status
+++ b/cws-status
@@ -111,8 +111,11 @@ item_statuses = tree.xpath('//table[//th[text()="Item"]]/tbody/tr/td[7]/text()')
matched_extensions = []
for i, name in enumerate(item_names_versions):
- print(i, name, item_names_versions, item_statuses)
- print(i, item_statuses)
+ # `item_statuses` can be shorter than `item_names_versions` for some
+ # reason. If that happens I guess just show what we could find.
+ if i >= len(item_statuses):
+ break
+
if re.search(regex, name):
matched_extensions.append((name, item_statuses[i]))