@@ -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