synthrepo: do not crash if a list is empty
authorBryan O'Sullivan <bryano@fb.com>
Mon, 10 Dec 2012 11:18:03 -0800
changeset 18047 9196638b08ce
parent 18046 40374059d227
child 18048 9b7288fc7bf2
synthrepo: do not crash if a list is empty
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, []