Commit 18d95b3e authored by Johannes Henkel's avatar Johannes Henkel Committed by Commit Bot

Make Binary() construct a proper, empty instance.

Feels the most efficient way to accomplish this is to
make data() and size() return appropriate values when
impl_ isn't set.

Bug: 1026646
Change-Id: I8f9f1cb6621173ced066065f4ec6b64b5a609322
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1935430Reviewed-by: default avatarAndrey Kosyakov <caseq@chromium.org>
Commit-Queue: Johannes Henkel <johannes@chromium.org>
Cr-Commit-Position: refs/heads/master@{#718945}
parent 7abba046
...@@ -113,8 +113,8 @@ class CORE_EXPORT Binary { ...@@ -113,8 +113,8 @@ class CORE_EXPORT Binary {
Binary() = default; Binary() = default;
const uint8_t* data() const { return impl_->data(); } const uint8_t* data() const { return impl_ ? impl_->data() : nullptr; }
size_t size() const { return impl_->size(); } size_t size() const { return impl_ ? impl_->size() : 0; }
String toBase64() const; String toBase64() const;
static Binary fromBase64(const String& base64, bool* success); static Binary fromBase64(const String& base64, bool* success);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment