Skip to content

Commit

Permalink
Fix: crashes due to NullPointerException in views
Browse files Browse the repository at this point in the history
  • Loading branch information
Kota Iguchi committed Jun 22, 2013
1 parent f48db35 commit b7a518f
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
Expand Up @@ -265,10 +265,12 @@ public boolean handleMessage(Message msg)
TiDimension nativeHeight = new TiDimension(v.getHeight(), TiDimension.TYPE_HEIGHT);

// TiDimension needs a view to grab the window manager, so we'll just use the decorview of the current window
View decorView = TiApplication.getAppCurrentActivity().getWindow().getDecorView();
if (TiApplication.getAppCurrentActivity() != null && TiApplication.getAppCurrentActivity().getWindow() != null) {
View decorView = TiApplication.getAppCurrentActivity().getWindow().getDecorView();

d.put(TiC.PROPERTY_WIDTH, nativeWidth.getAsDefault(decorView));
d.put(TiC.PROPERTY_HEIGHT, nativeHeight.getAsDefault(decorView));
d.put(TiC.PROPERTY_WIDTH, nativeWidth.getAsDefault(decorView));
d.put(TiC.PROPERTY_HEIGHT, nativeHeight.getAsDefault(decorView));
}
}
}
if (!d.containsKey(TiC.PROPERTY_WIDTH)) {
Expand Down
Expand Up @@ -510,6 +510,7 @@ protected void onLayout(boolean changed, int l, int t, int r, int b)

for (int i = 0; i < count; i++) {
View child = getChildAt(i);
if (child == null) continue;
TiCompositeLayout.LayoutParams params =
(TiCompositeLayout.LayoutParams) child.getLayoutParams();
if (child.getVisibility() != View.GONE) {
Expand Down
2 changes: 1 addition & 1 deletion build/titanium_version.py
@@ -1,2 +1,2 @@
version = '3.1.1'
version = '3.1.1.1'
module_apiversion = '2'

0 comments on commit b7a518f

Please sign in to comment.