Bug 1241117 - Fix mAppUuid access before assign in BluetoothGatt::Connect. r=joliu

This commit is contained in:
Chris Lord 2016-01-20 14:37:02 +00:00
Родитель 9c134bf2d5
Коммит 525d63acc9
1 изменённых файлов: 5 добавлений и 5 удалений

Просмотреть файл

@ -112,11 +112,6 @@ BluetoothGatt::Connect(ErrorResult& aRv)
BluetoothService* bs = BluetoothService::Get();
BT_ENSURE_TRUE_REJECT(bs, promise, NS_ERROR_NOT_AVAILABLE);
BluetoothUuid appUuid;
BT_ENSURE_TRUE_REJECT(NS_SUCCEEDED(StringToUuid(mAppUuid, appUuid)),
promise,
NS_ERROR_DOM_OPERATION_ERR);
BluetoothAddress deviceAddr;
BT_ENSURE_TRUE_REJECT(
NS_SUCCEEDED(StringToAddress(mDeviceAddr, deviceAddr)),
@ -131,6 +126,11 @@ BluetoothGatt::Connect(ErrorResult& aRv)
RegisterBluetoothSignalHandler(mAppUuid, this);
}
BluetoothUuid appUuid;
BT_ENSURE_TRUE_REJECT(NS_SUCCEEDED(StringToUuid(mAppUuid, appUuid)),
promise,
NS_ERROR_DOM_OPERATION_ERR);
UpdateConnectionState(BluetoothConnectionState::Connecting);
bs->ConnectGattClientInternal(
appUuid, deviceAddr, new BluetoothVoidReplyRunnable(nullptr, promise));