Permalink
Browse files

Merge pull request #216 from basho/jdb-capability-crash

  • Loading branch information...
2 parents 62af2bc + 8b6e04d commit abed2ad335486ba271c0fb1bb3faa0c80ea47cb2 @jtuple jtuple committed Jul 24, 2012
Showing with 11 additions and 7 deletions.
  1. +11 −7 src/riak_core_capability.erl
@@ -395,13 +395,17 @@ add_supported_to_ring(Node, Supported, Ring) ->
%% in the cluster.
negotiate_capabilities(Node, Override, State=#state{registered=Registered,
supported=Capabilities}) ->
- MyCaps = orddict:fetch(Node, Capabilities),
- N1 = reformat_capabilities(Registered, Capabilities),
- N2 = intersect_capabilities(N1),
- N3 = order_by_preference(MyCaps, N2),
- N4 = override_capabilities(N3, Override),
- N5 = [{Cap, hd(Common)} || {Cap, Common} <- N4],
- State#state{negotiated=N5}.
+ case orddict:find(Node, Capabilities) of
+ error ->
+ State;
+ {ok, MyCaps} ->
+ N1 = reformat_capabilities(Registered, Capabilities),
+ N2 = intersect_capabilities(N1),
+ N3 = order_by_preference(MyCaps, N2),
+ N4 = override_capabilities(N3, Override),
+ N5 = [{Cap, hd(Common)} || {Cap, Common} <- N4],
+ State#state{negotiated=N5}
+ end.
renegotiate_capabilities(State=#state{supported=[]}) ->
State;

0 comments on commit abed2ad

Please sign in to comment.