Index: chrome/browser/sync/util/cryptographer.cc |
diff --git a/chrome/browser/sync/util/cryptographer.cc b/chrome/browser/sync/util/cryptographer.cc |
index 01f7eb2a01a6ff99cda7142d26a65c6f9e099f57..7ee8c19ceff317f6ca79ef2665e037cd15e0a518 100644 |
--- a/chrome/browser/sync/util/cryptographer.cc |
+++ b/chrome/browser/sync/util/cryptographer.cc |
@@ -44,19 +44,21 @@ bool Cryptographer::CanDecryptUsingDefaultKey( |
bool Cryptographer::Encrypt(const ::google::protobuf::MessageLite& message, |
sync_pb::EncryptedData* encrypted) const { |
- DCHECK(encrypted); |
- DCHECK(default_nigori_); |
+ if (!encrypted || !default_nigori_) { |
+ LOG(ERROR) << "Cryptographer not ready, failed to encrypt."; |
+ return false; |
+ } |
std::string serialized; |
if (!message.SerializeToString(&serialized)) { |
- NOTREACHED(); // |message| is invalid/missing a required field. |
+ LOG(ERROR) << "Message is invalid/missing a required field."; |
return false; |
} |
encrypted->set_key_name(default_nigori_->first); |
if (!default_nigori_->second->Encrypt(serialized, |
encrypted->mutable_blob())) { |
- NOTREACHED(); // Encrypt should not fail. |
+ LOG(ERROR) << "Failed to encrypt data."; |
return false; |
} |
return true; |