From 6749b6a2df2223f06bb0fad2a474654aa4f365e5 Mon Sep 17 00:00:00 2001 From: Attila Dusnoki Date: Wed, 30 Nov 2016 15:28:50 +0100 Subject: [PATCH] Add missing connection check for disconnect --- components/script/dom/bluetoothremotegattserver.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/components/script/dom/bluetoothremotegattserver.rs b/components/script/dom/bluetoothremotegattserver.rs index 06c11f0aa211..275c7ff9841b 100644 --- a/components/script/dom/bluetoothremotegattserver.rs +++ b/components/script/dom/bluetoothremotegattserver.rs @@ -90,7 +90,10 @@ impl BluetoothRemoteGATTServerMethods for BluetoothRemoteGATTServer { fn Disconnect(&self) -> ErrorResult { // TODO: Step 1: Implement activeAlgorithms internal slot for BluetoothRemoteGATTServer. - // TODO: Step 2: Check if this.connected is false here too. + // Step 2. + if !self.Connected() { + return Ok(()); + } let (sender, receiver) = ipc::channel().unwrap(); self.get_bluetooth_thread().send( BluetoothRequest::GATTServerDisconnect(String::from(self.Device().Id()), sender)).unwrap();