Fix NPE when answering a call that has already gone away
This commit is contained in:
parent
4d011016db
commit
38450896d1
|
@ -220,7 +220,7 @@ public class ConnectionService extends android.telecom.ConnectionService {
|
|||
if (sessionId == null || !sessionId.equals(this.sessionId)) return;
|
||||
if (rtpConnection == null) {
|
||||
this.with = with; // Store full JID of connection
|
||||
rtpConnection = xmppConnectionService.getJingleConnectionManager().findJingleRtpConnection(account, with, sessionId);
|
||||
findRtpConnection();
|
||||
}
|
||||
|
||||
setStatusHints(new StatusHints(null, gatewayIcon, null));
|
||||
|
@ -269,15 +269,20 @@ public class ConnectionService extends android.telecom.ConnectionService {
|
|||
public void onAnswer() {
|
||||
// For incoming calls, a connection update may not have been triggered before answering
|
||||
// so we have to acquire the rtp connection object here
|
||||
this.rtpConnection = xmppConnectionService.getJingleConnectionManager().findJingleRtpConnection(account, with, sessionId);
|
||||
|
||||
findRtpConnection();
|
||||
if (rtpConnection == null || rtpConnection.get() == null) {
|
||||
close(new DisconnectCause(DisconnectCause.CANCELED));
|
||||
} else {
|
||||
rtpConnection.get().acceptCall();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onReject() {
|
||||
this.rtpConnection = xmppConnectionService.getJingleConnectionManager().findJingleRtpConnection(account, with, sessionId);
|
||||
findRtpConnection();
|
||||
if (rtpConnection != null && rtpConnection.get() != null) {
|
||||
rtpConnection.get().rejectCall();
|
||||
}
|
||||
close(new DisconnectCause(DisconnectCause.LOCAL));
|
||||
}
|
||||
|
||||
|
@ -316,6 +321,12 @@ public class ConnectionService extends android.telecom.ConnectionService {
|
|||
if (c) postDial();
|
||||
}
|
||||
|
||||
protected void findRtpConnection() {
|
||||
if (rtpConnection != null) return;
|
||||
|
||||
rtpConnection = xmppConnectionService.getJingleConnectionManager().findJingleRtpConnection(account, with, sessionId);
|
||||
}
|
||||
|
||||
protected void sleep(int ms) {
|
||||
try {
|
||||
Thread.sleep(ms);
|
||||
|
|
Loading…
Reference in a new issue