Commit 4c369070 authored by mcchou's avatar mcchou Committed by Commit bot

device/bluetooth: Fix copy constructor of BluetoothServiceAttributeValueBlueZ

The copy constructor was trying to call DeepCopy() against a nullptr. This adds
a check if the type is NULLTYPE and return base::Value() if so.

BUG=b:30963813
TEST=call the copy constructor with a NULLTYPE instance to see if it crashes

Review-Url: https://codereview.chromium.org/2284713002
Cr-Commit-Position: refs/heads/master@{#414746}
parent 6f165351
......@@ -33,6 +33,11 @@ BluetoothServiceAttributeValueBlueZ::BluetoothServiceAttributeValueBlueZ(
this->type_ = attribute.type_;
this->size_ = attribute.size_;
if (attribute.type_ == NULLTYPE) {
this->value_ = base::Value::CreateNullValue();
return;
}
if (attribute.type_ != SEQUENCE) {
this->value_ = base::WrapUnique(attribute.value_->DeepCopy());
return;
......
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