Fixed potential NPE in Bluetooth interface.

This commit is contained in:
Felix Ableitner 2016-02-01 14:34:46 +01:00
parent 9bb70aa405
commit 9af22b8897

View file

@ -210,6 +210,11 @@ class BluetoothInterface(context: Context, mainHandler: Handler,
* Returns all active Bluetooth connections. * Returns all active Bluetooth connections.
*/ */
override def getConnections: Set[Address] = override def getConnections: Set[Address] =
connections.map(x => addressDeviceMap.find(_._2 == x._1).get._1).toSet connections.flatMap { x =>
addressDeviceMap
.find(_._2 == x._1)
.map(_._1)
}
.toSet
} }