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

Commit fd4d7b5c authored by Jay Shrauner's avatar Jay Shrauner
Browse files

Handle null mConnectionService in disconnect

Check for null mConnectionService rather that throwing an exception.

Bug:17016200
Change-Id: Ib01d778b1991d4d44a5bc47d4c2d7dac6c262db8
parent d7f8b052
Loading
Loading
Loading
Loading
+14 −9
Original line number Diff line number Diff line
@@ -706,7 +706,7 @@ final class Call implements CreateConnectionResponse {
     */
    void stopDtmfTone() {
        if (mConnectionService == null) {
            Log.w(this, "stopDtmfTone() request on a call without a connectino service.");
            Log.w(this, "stopDtmfTone() request on a call without a connection service.");
        } else {
            Log.i(this, "Send stopDtmfTone to connection service for call %s", this);
            mConnectionService.stopDtmfTone(this);
@@ -717,19 +717,24 @@ final class Call implements CreateConnectionResponse {
     * Attempts to disconnect the call through the connection service.
     */
    void disconnect() {
        if (mState == CallState.NEW || mState == CallState.PRE_DIAL_WAIT) {
        if (mState == CallState.NEW || mState == CallState.PRE_DIAL_WAIT ||
                mState == CallState.CONNECTING) {
            Log.v(this, "Aborting call %s", this);
            abort();
        } else if (mState != CallState.ABORTED && mState != CallState.DISCONNECTED) {
            Preconditions.checkNotNull(mConnectionService);

            if (mConnectionService == null) {
                Log.e(this, new Exception(), "disconnect() request on a call without a"
                        + " connection service.");
            } else {
                Log.i(this, "Send disconnect to connection service for call: %s", this);
            // The call isn't officially disconnected until the connection service confirms that the
            // call was actually disconnected. Only then is the association between call and
            // connection service severed, see {@link CallsManager#markCallAsDisconnected}.
                // The call isn't officially disconnected until the connection service
                // confirms that the call was actually disconnected. Only then is the
                // association between call and connection service severed, see
                // {@link CallsManager#markCallAsDisconnected}.
                mConnectionService.disconnect(this);
            }
        }
    }

    void abort() {
        if (mCreateConnectionProcessor != null) {