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.
This commit is contained in:
Romain Guy
2009-06-16 13:17:50 -07:00
parent a6061e043c
commit 779398e7eb

View File

@@ -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;
}
}
/**