Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8e7766f3 authored by Andrew Cheng's avatar Andrew Cheng
Browse files

NullPointerException handling, connectObexSession

In connectObexSession, if a null mSocket is passed to
BluetoothObexTransport, then a NullPointerException will be thrown when
a new ClientSession is created.

This can occur if abort() --> closeSocket() is called between the calls
to connectSocket() and connectObexSession().

Bug: 142056980
Test: cycle Bluetooth adapter on/off 1k times
Change-Id: I78691eb03cd4f3e12922a31b1bc4f4144353c125
parent b59c1a9f
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -329,7 +329,10 @@ class PbapClientConnectionHandler extends Handler {
            if (DBG) {
                Log.d(TAG, "Success = " + Boolean.toString(connectionSuccessful));
            }
        } catch (IOException e) {
        } catch (IOException | NullPointerException e) {
            // Will get NPE if a null mSocket is passed to BluetoothObexTransport.
            // mSocket can be set to null if an abort() --> closeSocket() was called between
            // the calls to connectSocket() and connectObexSession().
            Log.w(TAG, "CONNECT Failure " + e.toString());
            closeSocket();
        }