Prevent crashes if no ttyrec files can be associated with a game.

If the postprocessing step finds no ttyrec files created between a
game's end and the previous game's end, it will no longer index an
empty list and crash.

The condition of finding no ttyrec files is still a bug that requires
investigation.
This commit is contained in:
John "Elwin" Edwards 2016-01-16 02:12:50 +00:00
parent 340e52a624
commit 2f95935349

View file

@ -226,6 +226,11 @@ class Game:
lowlim = itsEntries[i-1]["endt"]
hilim = itsEntries[i]["endt"]
recs = [ k[1] for k in vfilekeys if lowlim <= k[0] < hilim ]
if len(recs) == 0:
# There inexplicably are no files. TODO log an error.
itsEntries[i]["startt"] = lowlim
itsEntries[i]["ttyrecs"] = []
else:
itsEntries[i]["startt"] = recnameToTS(recs[0])
itsEntries[i]["ttyrecs"] = recs
cur.close()