summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon MacMullen <simon@rabbitmq.com>2012-12-05 11:23:27 +0000
committerSimon MacMullen <simon@rabbitmq.com>2012-12-05 11:23:27 +0000
commit3a39835972ce47b2c394561a7df4925284f9605d (patch)
tree5279a4b1ef2457e91aabc7efec26fad9197ccce3
parentaced165290575062a98f6e5774c3780f40ee3dc0 (diff)
downloadrabbitmq-server-git-3a39835972ce47b2c394561a7df4925284f9605d.tar.gz
Don't blow up if we end up talking to not-a-supervisor.
-rw-r--r--src/rabbit_vm.erl10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/rabbit_vm.erl b/src/rabbit_vm.erl
index 53f3df18b3..e96792762c 100644
--- a/src/rabbit_vm.erl
+++ b/src/rabbit_vm.erl
@@ -84,7 +84,15 @@ sup_memory(Sup) ->
sup_children(Sup) ->
rabbit_misc:with_exit_handler(
- rabbit_misc:const([]), fun () -> supervisor:which_children(Sup) end).
+ rabbit_misc:const([]),
+ fun () ->
+ %% Just in case we end up talking to something that is
+ %% not a supervisor by mistake.
+ case supervisor:which_children(Sup) of
+ L when is_list(L) -> L;
+ _ -> []
+ end
+ end).
pid_memory(Pid) when is_pid(Pid) -> case process_info(Pid, memory) of
{memory, M} -> M;