Skip to content

Commit

Permalink
fix: raise error if empty header
Browse files Browse the repository at this point in the history
  • Loading branch information
YodaEmbedding committed Aug 8, 2023
1 parent 4be3d13 commit 001ce2c
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions pyntcloud/io/off.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ def read_off(filename):
if "OFF" not in first_line:
raise ValueError("The file does not start with the word OFF")
has_color = "C" in first_line
num_rows = None

# Read header.
for line in f:
Expand All @@ -25,6 +26,9 @@ def read_off(filename):
num_rows = n_points + n_faces
break

if num_rows is None:
raise ValueError("The file does not contain a valid header")

# Read remaining lines.
lines = [next(f) for _ in range(num_rows)]

Expand Down

0 comments on commit 001ce2c

Please sign in to comment.