Work fork of an Android Jabber client for bridge users git.sr.ht/~singpolyma/cheogram-android
sopranica sgx xmpp jabber
0

Configure Feed

Select the types of activity you want to include in your feed.

Fix NPE when answering a call that has already gone away

Stephen Paul Weber (Mar 22, 2022, 9:14 AM -0500) 38450896 4d011016

+17 -6
+17 -6
src/cheogram/java/com/cheogram/android/ConnectionService.java
··· 220 220 if (sessionId == null || !sessionId.equals(this.sessionId)) return; 221 221 if (rtpConnection == null) { 222 222 this.with = with; // Store full JID of connection 223 - rtpConnection = xmppConnectionService.getJingleConnectionManager().findJingleRtpConnection(account, with, sessionId); 223 + findRtpConnection(); 224 224 } 225 225 226 226 setStatusHints(new StatusHints(null, gatewayIcon, null)); ··· 269 269 public void onAnswer() { 270 270 // For incoming calls, a connection update may not have been triggered before answering 271 271 // so we have to acquire the rtp connection object here 272 - this.rtpConnection = xmppConnectionService.getJingleConnectionManager().findJingleRtpConnection(account, with, sessionId); 273 - 274 - rtpConnection.get().acceptCall(); 272 + findRtpConnection(); 273 + if (rtpConnection == null || rtpConnection.get() == null) { 274 + close(new DisconnectCause(DisconnectCause.CANCELED)); 275 + } else { 276 + rtpConnection.get().acceptCall(); 277 + } 275 278 } 276 279 277 280 @Override 278 281 public void onReject() { 279 - this.rtpConnection = xmppConnectionService.getJingleConnectionManager().findJingleRtpConnection(account, with, sessionId); 280 - rtpConnection.get().rejectCall(); 282 + findRtpConnection(); 283 + if (rtpConnection != null && rtpConnection.get() != null) { 284 + rtpConnection.get().rejectCall(); 285 + } 281 286 close(new DisconnectCause(DisconnectCause.LOCAL)); 282 287 } 283 288 ··· 314 319 @Override 315 320 public void onPostDialContinue(boolean c) { 316 321 if (c) postDial(); 322 + } 323 + 324 + protected void findRtpConnection() { 325 + if (rtpConnection != null) return; 326 + 327 + rtpConnection = xmppConnectionService.getJingleConnectionManager().findJingleRtpConnection(account, with, sessionId); 317 328 } 318 329 319 330 protected void sleep(int ms) {