Skip to content

Commit d0ffef4

Browse files
Wink SavilleAndroid Git Automerger
authored andcommitted
am 19b23af: Merge "Fix for phone app crash in Icc Card."
* commit '19b23afadf1053a8e06cb3444d9cdae3405ad9a1': Fix for phone app crash in Icc Card.
2 parents d9c17cc + 19b23af commit d0ffef4

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

telephony/java/com/android/internal/telephony/IccCard.java

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -487,6 +487,12 @@ public void handleMessage(Message msg){
487487
CommandsInterface.SERVICE_CLASS_DATA +
488488
CommandsInterface.SERVICE_CLASS_FAX;
489489

490+
if (!mPhone.mIsTheCurrentActivePhone) {
491+
Log.e(mLogTag, "Received message " + msg + "[" + msg.what
492+
+ "] while being destroyed. Ignoring.");
493+
return;
494+
}
495+
490496
switch (msg.what) {
491497
case EVENT_RADIO_OFF_OR_NOT_AVAILABLE:
492498
mState = null;
@@ -626,7 +632,13 @@ public State getIccCardState() {
626632
index = mIccCardStatus.getGsmUmtsSubscriptionAppIndex();
627633
}
628634

629-
IccCardApplication app = mIccCardStatus.getApplication(index);
635+
IccCardApplication app;
636+
if (index >= 0 && index < IccCardStatus.CARD_MAX_APPS) {
637+
app = mIccCardStatus.getApplication(index);
638+
} else {
639+
Log.e(mLogTag, "[IccCard] Invalid Subscription Application index:" + index);
640+
return IccCard.State.ABSENT;
641+
}
630642

631643
if (app == null) {
632644
Log.e(mLogTag, "[IccCard] Subscription Application in not present");

0 commit comments

Comments
 (0)