Repository: couchdb-fabric Updated Branches: refs/heads/master e5c9c62d8 -> 9f4c9994f
Fix rexi_DOWN and rexi_EXIT handlers In the cases when we receive rexi_DOWN or rexi_EXIT we call handle_message with {ok, []}. This crashes lists:min/1. Since it expects a list with at least one element. COUCHDB-3037 Project: http://git-wip-us.apache.org/repos/asf/couchdb-fabric/repo Commit: http://git-wip-us.apache.org/repos/asf/couchdb-fabric/commit/a506e8d5 Tree: http://git-wip-us.apache.org/repos/asf/couchdb-fabric/tree/a506e8d5 Diff: http://git-wip-us.apache.org/repos/asf/couchdb-fabric/diff/a506e8d5 Branch: refs/heads/master Commit: a506e8d5982cfe8081c50c0f96ee1938f8585e5e Parents: e5c9c62 Author: ILYA Khlopotov <iil...@ca.ibm.com> Authored: Mon Jun 13 09:19:03 2016 -0700 Committer: ILYA Khlopotov <iil...@ca.ibm.com> Committed: Mon Jun 13 09:19:03 2016 -0700 ---------------------------------------------------------------------- src/fabric_doc_open_revs.erl | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/couchdb-fabric/blob/a506e8d5/src/fabric_doc_open_revs.erl ---------------------------------------------------------------------- diff --git a/src/fabric_doc_open_revs.erl b/src/fabric_doc_open_revs.erl index 0924313..9228991 100644 --- a/src/fabric_doc_open_revs.erl +++ b/src/fabric_doc_open_revs.erl @@ -160,8 +160,10 @@ sort_key({{not_found, _}, {Pos, Rev}}) -> dict_replies(Dict, []) -> - Counts = [Count || {_Key, {_Reply, Count}} <- Dict], - {Dict, lists:min(Counts)}; + case [Count || {_Key, {_Reply, Count}} <- Dict] of + [] -> {Dict, 0}; + Counts -> {Dict, lists:min(Counts)} + end; dict_replies(Dict, [Reply | Rest]) -> NewDict = fabric_util:update_counter(Reply, 1, Dict),