From 6a5c3a6c8e8ebcc8e2bbf979bfb81b2409f2442a Mon Sep 17 00:00:00 2001 From: Simon MacMullen Date: Tue, 2 Jul 2013 15:01:10 +0100 Subject: Guard aganist the case where a delegate-executed function does some monitoring. --- src/delegate.erl | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'src/delegate.erl') diff --git a/src/delegate.erl b/src/delegate.erl index 03086a590e..460a48996f 100644 --- a/src/delegate.erl +++ b/src/delegate.erl @@ -204,9 +204,13 @@ handle_cast({invoke, Fun, Grouped}, State = #state{node = Node}) -> handle_info({'DOWN', Ref, process, Object, Info}, State = #state{monitors = Monitors}) -> - WantsMonitor = dict:fetch(Ref, Monitors), - WantsMonitor ! {'DOWN', Ref, process, Object, Info}, - {noreply, State#state{monitors = dict:erase(Ref, Monitors)}, hibernate}; + {noreply, case dict:find(Ref, Monitors) of + {ok, WantsMonitor} -> + WantsMonitor ! {'DOWN', Ref, process, Object, Info}, + State#state{monitors = dict:erase(Ref, Monitors)}; + error -> + State + end, hibernate}; handle_info(_Info, State) -> {noreply, State, hibernate}. -- cgit v1.2.1