From 0a3c7a196fe7fa0622b59b62e46ba10cbfe2968a Mon Sep 17 00:00:00 2001 From: Yorke Lee Date: Mon, 22 Sep 2014 19:30:24 -0700 Subject: Add null check when auto-scrolling listView Bug: 17609944 Change-Id: Icb14a0539ee3e57ddfc8e237e440b4563fccabf5 --- src/com/android/dialer/calllog/CallLogFragment.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/com/android/dialer/calllog/CallLogFragment.java b/src/com/android/dialer/calllog/CallLogFragment.java index 2f0ee5370..e5c3c58a5 100644 --- a/src/com/android/dialer/calllog/CallLogFragment.java +++ b/src/com/android/dialer/calllog/CallLogFragment.java @@ -601,7 +601,7 @@ public class CallLogFragment extends AnalyticsListFragment view.getLocalVisibleRect(localVisibleRect); final int scrollingNeeded = localVisibleRect.top > 0 ? -localVisibleRect.top : view.getMeasuredHeight() - localVisibleRect.height(); - + final ListView listView = getListView(); animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { private int mCurrentScroll = 0; @@ -618,9 +618,11 @@ public class CallLogFragment extends AnalyticsListFragment view.requestLayout(); if (isExpand) { - int scrollBy = (int) (value * scrollingNeeded) - mCurrentScroll; - getListView().smoothScrollBy(scrollBy, /* duration = */ 0); - mCurrentScroll += scrollBy; + if (listView != null) { + int scrollBy = (int) (value * scrollingNeeded) - mCurrentScroll; + listView.smoothScrollBy(scrollBy, /* duration = */ 0); + mCurrentScroll += scrollBy; + } } } }); -- cgit v1.2.3