diff options
| author | Michael Klishin <michael@rabbitmq.com> | 2013-06-19 15:57:00 +0400 |
|---|---|---|
| committer | Michael Klishin <michael@rabbitmq.com> | 2013-06-19 15:57:00 +0400 |
| commit | 4ccdfa1d20739de1daf65f79826556c61bbb74d7 (patch) | |
| tree | c516c62a59c05b4f8a174a1336dcb61d5cdfb190 /src | |
| parent | 52e22ebdbfaea3cd34565b31f8739859fa97dbd5 (diff) | |
| download | rabbitmq-server-git-4ccdfa1d20739de1daf65f79826556c61bbb74d7.tar.gz | |
Don't crash when an alarm is cleared when there's nothing to clear
Diffstat (limited to 'src')
| -rw-r--r-- | src/rabbit_alarm.erl | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/rabbit_alarm.erl b/src/rabbit_alarm.erl index 17f1edcf93..0724757302 100644 --- a/src/rabbit_alarm.erl +++ b/src/rabbit_alarm.erl @@ -145,7 +145,12 @@ dict_unappend_all(Key, _Val, Dict) -> dict:erase(Key, Dict). dict_unappend(Key, Val, Dict) -> - case lists:delete(Val, dict:fetch(Key, Dict)) of + L = case dict:find(Key, Dict) of + {ok, V} -> V; + error -> [] + end, + + case lists:delete(Val, L) of [] -> dict:erase(Key, Dict); X -> dict:store(Key, X, Dict) end. |
