# HG changeset patch # User Bryan O'Sullivan # Date 1355167083 28800 # Node ID 9196638b08cee5a39d4b8d6b9054d0ff3cb48481 # Parent 40374059d227850ec2f5fb4f21a1b619136e2a6a synthrepo: do not crash if a list is empty diff -r 40374059d227 -r 9196638b08ce contrib/synthrepo.py --- a/contrib/synthrepo.py Tue Nov 27 22:24:02 2012 +0100 +++ b/contrib/synthrepo.py Mon Dec 10 11:18:03 2012 -0800 @@ -231,6 +231,8 @@ fp.close() def cdf(l): + if not l: + return [], [] vals, probs = zip(*sorted(l, key=lambda x: x[1], reverse=True)) t = float(sum(probs, 0)) s, cdfs = 0, []