Skip to content

Commit

Permalink
mavgraph: avoid exception on corrupt log
Browse files Browse the repository at this point in the history
ValueError exception thrown on a large _timestamp when determining tdays
  • Loading branch information
peterbarker authored and tridge committed May 20, 2016
1 parent 9108253 commit eeb4e0c
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion pymavlink/tools/mavgraph.py
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,12 @@ def process_file(filename, timeshift):
while True:
msg = mlog.recv_match(args.condition)
if msg is None: break
tdays = matplotlib.dates.date2num(datetime.datetime.fromtimestamp(msg._timestamp+timeshift))
try:
tdays = matplotlib.dates.date2num(datetime.datetime.fromtimestamp(msg._timestamp+timeshift))
except ValueError:
# this can happen if the log is corrupt
# ValueError: year is out of range
break
add_data(tdays, msg, mlog.messages, mlog.flightmode)

if len(filenames) == 0:
Expand Down

0 comments on commit eeb4e0c

Please sign in to comment.