diff options
| author | Romain Guy <romainguy@android.com> | 2009-06-16 13:17:50 -0700 |
|---|---|---|
| committer | Romain Guy <romainguy@android.com> | 2009-06-16 13:17:50 -0700 |
| commit | 779398e7eb462ca1562eee50a919305849582e08 (patch) | |
| tree | 7d1258c6087908c2fd77a6843e6c47f02b4fa5ed | |
| parent | a6061e043cb6056c303206c2c9870ae3758861f1 (diff) | |
| download | frameworks_base-779398e7eb462ca1562eee50a919305849582e08.zip frameworks_base-779398e7eb462ca1562eee50a919305849582e08.tar.gz frameworks_base-779398e7eb462ca1562eee50a919305849582e08.tar.bz2 | |
Fixes a potential NPE in View.
Calling getLocationOnScreen() before the View is attached to a window can
throw an NPE. This change simply guards against the exception.
| -rw-r--r-- | core/java/android/view/View.java | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java index 0497344..ec8fd96 100644 --- a/core/java/android/view/View.java +++ b/core/java/android/view/View.java @@ -7157,8 +7157,10 @@ public class View implements Drawable.Callback, KeyEvent.Callback, Accessibility getLocationInWindow(location); final AttachInfo info = mAttachInfo; - location[0] += info.mWindowLeft; - location[1] += info.mWindowTop; + if (info != null) { + location[0] += info.mWindowLeft; + location[1] += info.mWindowTop; + } } /** |
