Fix NPE in onDestroy.

NPE can happen when calls are canceled immediately before incallservice
has a chance to respond.

Bug:17362107
Change-Id: I6bf318f5f7d89731b686a1523678a26764fa9bf3
This commit is contained in:
Santos Cordon
2014-09-02 17:13:45 -07:00
parent 1611c21dfd
commit 619b3c0d09

View File

@@ -165,11 +165,13 @@ public abstract class InCallService extends Service {
@Override
public boolean onUnbind(Intent intent) {
Phone oldPhone = mPhone;
mPhone = null;
if (mPhone != null) {
Phone oldPhone = mPhone;
mPhone = null;
oldPhone.destroy();
onPhoneDestroyed(oldPhone);
oldPhone.destroy();
onPhoneDestroyed(oldPhone);
}
return false;
}