Skip to content

Commit 38533ea

Browse files
sganovAndroid (Google) Code Review
authored andcommitted
Merge "NPE in AcitivtyChooserModel." into jb-mr1-dev
2 parents 08681ad + abcaeea commit 38533ea

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

core/java/android/widget/ActivityChooserModel.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
import android.content.Intent;
2222
import android.content.pm.ResolveInfo;
2323
import android.database.DataSetObservable;
24-
import android.database.DataSetObserver;
2524
import android.os.AsyncTask;
2625
import android.text.TextUtils;
2726
import android.util.Log;
@@ -458,13 +457,18 @@ public int getActivityIndex(ResolveInfo activity) {
458457
* </p>
459458
*
460459
* @return An {@link Intent} for launching the activity or null if the
461-
* policy has consumed the intent.
460+
* policy has consumed the intent or there is not current intent
461+
* set via {@link #setIntent(Intent)}.
462462
*
463463
* @see HistoricalRecord
464464
* @see OnChooseActivityListener
465465
*/
466466
public Intent chooseActivity(int index) {
467467
synchronized (mInstanceLock) {
468+
if (mIntent == null) {
469+
return null;
470+
}
471+
468472
ensureConsistentState();
469473

470474
ActivityResolveInfo chosenActivity = mActivities.get(index);

0 commit comments

Comments
 (0)