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
commit2d9e8374bd77ef1b3541ecdf734503f36b58a82d (patch)
tree5279a4b1ef2457e91aabc7efec26fad9197ccce3
parent5c30e7cf1fd1502ed5b30da8a6617705f27cd34f (diff)
downloadrabbitmq-server-bug25341.tar.gz
Don't blow up if we end up talking to not-a-supervisor.bug25341
-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 53f3df18..e9679276 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;