From 00edd430ab158c34ac4a344b93cf46cd8d4912b1 Mon Sep 17 00:00:00 2001 From: Siri Hansen Date: Thu, 31 Jan 2019 11:48:02 +0100 Subject: [observer] Don't crash on Log > Toggle Log View Since Logger was introduced in OTP-21.0, menu choice Log > Toggle Log View in observer would cause a crash unless an error_logger event handler was explicitly installed. This is now corrected. --- lib/observer/src/observer_wx.erl | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'lib/observer/src') diff --git a/lib/observer/src/observer_wx.erl b/lib/observer/src/observer_wx.erl index 453e3bdc2d..fe51afa240 100644 --- a/lib/observer/src/observer_wx.erl +++ b/lib/observer/src/observer_wx.erl @@ -771,7 +771,11 @@ ensure_sasl_started(Node) -> ensure_mf_h_handler_used(Node) -> %% is log_mf_h used ? - Handlers = rpc:block_call(Node, gen_event, which_handlers, [error_logger]), + Handlers = + case rpc:block_call(Node, gen_event, which_handlers, [error_logger]) of + {badrpc,{'EXIT',noproc}} -> []; % OTP-21+ and no event handler exists + Hs -> Hs + end, case lists:any(fun(L)-> L == log_mf_h end, Handlers) of false -> throw("Error: log_mf_h handler not used in sasl."), error; -- cgit v1.2.3