synthrepo: do not crash if a list is empty

This commit is contained in:
Bryan O'Sullivan 2012-12-10 11:18:03 -08:00
parent d3a4755c75
commit 75dc399824

View File

@ -231,6 +231,8 @@ def synthesize(ui, repo, descpath, **opts):
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, []