Skip to content

Commit f8c1f12

Browse files
cco3Android Git Automerger
authored andcommitted
am e1d2715: am f87743e: Merge "Prevent NullPointerException cases while using SipService."
* commit 'e1d271546767a8e2213aabba92506af9e97020b4': Prevent NullPointerException cases while using SipService.
2 parents 5bb3129 + e1d2715 commit f8c1f12

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

voip/java/android/net/sip/SipManager.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -471,6 +471,10 @@ public void register(SipProfile localProfile, int expiryTime,
471471
try {
472472
ISipSession session = mSipService.createSession(localProfile,
473473
createRelay(listener, localProfile.getUriString()));
474+
if (session == null) {
475+
throw new SipException(
476+
"SipService.createSession() returns null");
477+
}
474478
session.register(expiryTime);
475479
} catch (RemoteException e) {
476480
throw new SipException("register()", e);
@@ -492,6 +496,10 @@ public void unregister(SipProfile localProfile,
492496
try {
493497
ISipSession session = mSipService.createSession(localProfile,
494498
createRelay(listener, localProfile.getUriString()));
499+
if (session == null) {
500+
throw new SipException(
501+
"SipService.createSession() returns null");
502+
}
495503
session.unregister();
496504
} catch (RemoteException e) {
497505
throw new SipException("unregister()", e);
@@ -513,7 +521,7 @@ public SipSession getSessionFor(Intent incomingCallIntent)
513521
try {
514522
String callId = getCallId(incomingCallIntent);
515523
ISipSession s = mSipService.getPendingSession(callId);
516-
return new SipSession(s);
524+
return ((s == null) ? null : new SipSession(s));
517525
} catch (RemoteException e) {
518526
throw new SipException("getSessionFor()", e);
519527
}

0 commit comments

Comments
 (0)