FIx potential NPE

Bug: 18052047
Change-Id: I9097d0a504b8a1d875cf66e44bb65eb6ecc8908e
This commit is contained in:
Tadashi G. Takaoka 2014-10-21 14:13:27 +09:00
parent 9ba36f29cc
commit 097bcdcde8

View file

@ -57,7 +57,7 @@ public final class ViewLayoutUtils {
public static void updateLayoutHeightOf(final Window window, final int layoutHeight) { public static void updateLayoutHeightOf(final Window window, final int layoutHeight) {
final WindowManager.LayoutParams params = window.getAttributes(); final WindowManager.LayoutParams params = window.getAttributes();
if (params.height != layoutHeight) { if (params != null && params.height != layoutHeight) {
params.height = layoutHeight; params.height = layoutHeight;
window.setAttributes(params); window.setAttributes(params);
} }
@ -65,7 +65,7 @@ public final class ViewLayoutUtils {
public static void updateLayoutHeightOf(final View view, final int layoutHeight) { public static void updateLayoutHeightOf(final View view, final int layoutHeight) {
final ViewGroup.LayoutParams params = view.getLayoutParams(); final ViewGroup.LayoutParams params = view.getLayoutParams();
if (params.height != layoutHeight) { if (params != null && params.height != layoutHeight) {
params.height = layoutHeight; params.height = layoutHeight;
view.setLayoutParams(params); view.setLayoutParams(params);
} }