Index: remoting/host/setup/native_messaging_host.cc |
diff --git a/remoting/host/setup/native_messaging_host.cc b/remoting/host/setup/native_messaging_host.cc |
index 621866746787829024323289dd4fbb9acebfe131..55d002075400f448a25b7506e93be9ab26928333 100644 |
--- a/remoting/host/setup/native_messaging_host.cc |
+++ b/remoting/host/setup/native_messaging_host.cc |
@@ -150,9 +150,13 @@ bool NativeMessagingHost::ProcessHello( |
bool NativeMessagingHost::ProcessClearPairedClients( |
const base::DictionaryValue& message, |
scoped_ptr<base::DictionaryValue> response) { |
- pairing_registry_->ClearAllPairings( |
- base::Bind(&NativeMessagingHost::SendBooleanResult, weak_ptr_, |
- base::Passed(&response))); |
+ if (pairing_registry_) { |
+ pairing_registry_->ClearAllPairings( |
+ base::Bind(&NativeMessagingHost::SendBooleanResult, weak_ptr_, |
+ base::Passed(&response))); |
+ } else { |
+ SendBooleanResult(response.Pass(), false); |
+ } |
return true; |
} |
@@ -166,9 +170,13 @@ bool NativeMessagingHost::ProcessDeletePairedClient( |
return false; |
} |
- pairing_registry_->DeletePairing( |
- client_id, base::Bind(&NativeMessagingHost::SendBooleanResult, weak_ptr_, |
- base::Passed(&response))); |
+ if (pairing_registry_) { |
+ pairing_registry_->DeletePairing( |
+ client_id, base::Bind(&NativeMessagingHost::SendBooleanResult, |
+ weak_ptr_, base::Passed(&response))); |
+ } else { |
+ SendBooleanResult(response.Pass(), false); |
+ } |
return true; |
} |
@@ -237,9 +245,14 @@ bool NativeMessagingHost::ProcessGetDaemonConfig( |
bool NativeMessagingHost::ProcessGetPairedClients( |
const base::DictionaryValue& message, |
scoped_ptr<base::DictionaryValue> response) { |
- pairing_registry_->GetAllPairings( |
- base::Bind(&NativeMessagingHost::SendPairedClientsResponse, weak_ptr_, |
- base::Passed(&response))); |
+ if (pairing_registry_) { |
+ pairing_registry_->GetAllPairings( |
+ base::Bind(&NativeMessagingHost::SendPairedClientsResponse, weak_ptr_, |
+ base::Passed(&response))); |
+ } else { |
+ scoped_ptr<base::ListValue> no_paired_clients(new base::ListValue); |
+ SendPairedClientsResponse(response.Pass(), no_paired_clients.Pass()); |
+ } |
return true; |
} |