metrics: 'Send' method crashes on NULL ErrorPtr

TEST=manually tested on panther_embedded
BUG=none

Change-Id: Iced380180918839d34a46e1cb2743a4cffdd5b4c
Reviewed-on: https://chromium-review.googlesource.com/220780
Reviewed-by: Bertrand Simonnet <bsimonnet@chromium.org>
Commit-Queue: Nathan Bullock <nathanbullock@google.com>
Tested-by: Nathan Bullock <nathanbullock@google.com>
This commit is contained in:
Nathan Bullock 2014-10-01 09:31:31 -04:00 committed by chrome-internal-fetch
parent dfea2f8992
commit 52d9edb590

View file

@ -29,7 +29,9 @@ bool HttpSender::Send(const std::string& content,
chromeos::http::Transport::CreateDefault(),
&error);
if (!response || response->GetDataAsString() != "OK") {
DLOG(ERROR) << "Failed to send data: " << error->GetMessage();
if (error) {
DLOG(ERROR) << "Failed to send data: " << error->GetMessage();
}
return false;
}
return true;