diff options
| author | Craig Mautner <cmautner@google.com> | 2012-12-05 12:24:03 -0800 |
|---|---|---|
| committer | Android (Google) Code Review <android-gerrit@google.com> | 2012-12-05 12:24:25 -0800 |
| commit | ddd75cb1ac225f8ffe8c78a5be8ceb589e0cda27 (patch) | |
| tree | 5eb535f77f406326b8faa4a197431a61fe5a5b2b /core/java | |
| parent | 07efb0303ff031512b7c38c6e7e9c2fcdb5849c0 (diff) | |
| parent | 54ae2f389cd0d9b9a558b5f61e096aec6215966b (diff) | |
Merge "Fix NPE when showing Toast from system process." into jb-mr1.1-dev
Diffstat (limited to 'core/java')
| -rw-r--r-- | core/java/android/widget/Toast.java | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/core/java/android/widget/Toast.java b/core/java/android/widget/Toast.java index 485bd37a266e..1d85126ecb42 100644 --- a/core/java/android/widget/Toast.java +++ b/core/java/android/widget/Toast.java @@ -374,8 +374,11 @@ public class Toast { // remove the old view if necessary handleHide(); mView = mNextView; - mWM = (WindowManager)mView.getContext().getApplicationContext() - .getSystemService(Context.WINDOW_SERVICE); + Context context = mView.getContext().getApplicationContext(); + if (context == null) { + context = mView.getContext(); + } + mWM = (WindowManager)context.getSystemService(Context.WINDOW_SERVICE); // We can resolve the Gravity here by using the Locale for getting // the layout direction final Configuration config = mView.getContext().getResources().getConfiguration(); |
