Skip to content

Commit

Permalink
[html] prevent error when parsing an empty table
Browse files Browse the repository at this point in the history
  • Loading branch information
midichef committed Nov 27, 2023
1 parent c34ed42 commit 8057154
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions visidata/loaders/html.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,8 +154,11 @@ def iterload(self):
if headers:
it = itertools.zip_longest(*headers, fillvalue='')
else:
it = list(list(x) for x in self.rows.pop(0))
it += [''] * (ncols-len(it))
if len(self.rows) > 0:
it = list(list(x) for x in self.rows.pop(0))
it += [''] * (ncols-len(it))
else:
it = []

for colnum, names in enumerate(it):
name = '_'.join(str(x) for x in names if x)
Expand Down

0 comments on commit 8057154

Please # to comment.