summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/ccan/tally/tally.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/ccan/tally/tally.c b/lib/ccan/tally/tally.c
index 936b514256..20e99dcb87 100644
--- a/lib/ccan/tally/tally.c
+++ b/lib/ccan/tally/tally.c
@@ -386,8 +386,9 @@ ssize_t tally_approx_median(const struct tally *tally, size_t *err)
for (i = 0; i < tally->buckets; i++) {
total += tally->counts[i];
- if (total * 2 >= count)
+ if (total * 2 >= count) {
break;
+ }
}
return bucket_range(tally, i, err);
}