From 9af22b8897dd5b8a5ab4f7c64215d050f2ad29f6 Mon Sep 17 00:00:00 2001 From: Felix Ableitner Date: Mon, 1 Feb 2016 14:34:46 +0100 Subject: [PATCH] Fixed potential NPE in Bluetooth interface. --- .../nutomic/ensichat/bluetooth/BluetoothInterface.scala | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/android/src/main/scala/com/nutomic/ensichat/bluetooth/BluetoothInterface.scala b/android/src/main/scala/com/nutomic/ensichat/bluetooth/BluetoothInterface.scala index e8c2371..46a2937 100644 --- a/android/src/main/scala/com/nutomic/ensichat/bluetooth/BluetoothInterface.scala +++ b/android/src/main/scala/com/nutomic/ensichat/bluetooth/BluetoothInterface.scala @@ -210,6 +210,11 @@ class BluetoothInterface(context: Context, mainHandler: Handler, * Returns all active Bluetooth connections. */ 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 }