summaryrefslogtreecommitdiffstats
path: root/voip
diff options
context:
space:
mode:
authorMasahiko Endo <masahiko.endo@gmail.com>2011-07-28 21:51:43 +0900
committerMasahiko Endo <masahiko.endo@gmail.com>2011-08-01 16:24:59 +0900
commit25ccbb97ffd3298caede635f29445073e845cfc3 (patch)
tree9df4200200c7c05e1b872991adece7075aae886a /voip
parent01caec8c4165a6cce2f276f8016b9eadab966944 (diff)
downloadframeworks_base-25ccbb97ffd3298caede635f29445073e845cfc3.zip
frameworks_base-25ccbb97ffd3298caede635f29445073e845cfc3.tar.gz
frameworks_base-25ccbb97ffd3298caede635f29445073e845cfc3.tar.bz2
Prevent NullPointerException cases while using SipService.
Some SipService methods may return null, in such cases like no Wi-Fi connection. Added minimum check to prevent NullPointerExceptions. Change-Id: Ia7fae57ee893f2564cbfdedb6dc614938ab60ff7 Signed-off-by: Masahiko Endo <masahiko.endo@gmail.com>
Diffstat (limited to 'voip')
-rw-r--r--voip/java/android/net/sip/SipManager.java10
1 files changed, 9 insertions, 1 deletions
diff --git a/voip/java/android/net/sip/SipManager.java b/voip/java/android/net/sip/SipManager.java
index dce46fe..cd0b5c4 100644
--- a/voip/java/android/net/sip/SipManager.java
+++ b/voip/java/android/net/sip/SipManager.java
@@ -471,6 +471,10 @@ public class SipManager {
try {
ISipSession session = mSipService.createSession(localProfile,
createRelay(listener, localProfile.getUriString()));
+ if (session == null) {
+ throw new SipException(
+ "SipService.createSession() returns null");
+ }
session.register(expiryTime);
} catch (RemoteException e) {
throw new SipException("register()", e);
@@ -492,6 +496,10 @@ public class SipManager {
try {
ISipSession session = mSipService.createSession(localProfile,
createRelay(listener, localProfile.getUriString()));
+ if (session == null) {
+ throw new SipException(
+ "SipService.createSession() returns null");
+ }
session.unregister();
} catch (RemoteException e) {
throw new SipException("unregister()", e);
@@ -513,7 +521,7 @@ public class SipManager {
try {
String callId = getCallId(incomingCallIntent);
ISipSession s = mSipService.getPendingSession(callId);
- return new SipSession(s);
+ return ((s == null) ? null : new SipSession(s));
} catch (RemoteException e) {
throw new SipException("getSessionFor()", e);
}