Bug 1660893 - Don't crash when the remote agent can't be initialized, r=remote-protocol-reviewers,whimboo

Set the command line handler to null when we can't start the service

Differential Revision: https://phabricator.services.mozilla.com/D90463
This commit is contained in:
James Graham 2020-09-16 19:51:54 +00:00
parent 7121ee534b
commit 0e2ebe15cb

View File

@ -29,8 +29,11 @@ macro_rules! fatalln {
#[no_mangle]
pub unsafe extern "C" fn new_remote_agent_handler(result: *mut *const nsICommandLineHandler) {
let handler: RefPtr<RemoteAgentHandler> = RemoteAgentHandler::new().unwrap();
RefPtr::new(handler.coerce::<nsICommandLineHandler>()).forget(&mut *result);
if let Ok(handler) = RemoteAgentHandler::new() {
RefPtr::new(handler.coerce::<nsICommandLineHandler>()).forget(&mut *result);
} else {
*result = std::ptr::null();
}
}
#[derive(xpcom)]