From 2972350f83fe70e3be3792df9e1f3bd63a66b271 Mon Sep 17 00:00:00 2001 From: Jay Shrauner Date: Fri, 6 Dec 2013 13:57:41 -0800 Subject: Fix potential NPE in saveHorizontalOffsets Fix potential NPE in saveHorizontalOffsets. Bug:12031506 Change-Id: I713fed5995356bdaaf93186454dcc53b92cb75ec (cherry picked from commit d0aa0f6fa23a345cbd117d3aa89e1dc95f857050) --- src/com/android/dialer/list/PhoneFavoriteFragment.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/com/android/dialer/list/PhoneFavoriteFragment.java b/src/com/android/dialer/list/PhoneFavoriteFragment.java index 34666ee99..04611b4ec 100644 --- a/src/com/android/dialer/list/PhoneFavoriteFragment.java +++ b/src/com/android/dialer/list/PhoneFavoriteFragment.java @@ -453,8 +453,11 @@ public class PhoneFavoriteFragment extends Fragment implements OnItemClickListen } private void saveHorizontalOffsets(ContactTileRow row, ArrayList list) { - for (int i = 0; i < list.size(); i++) { + for (int i = 0; i < list.size() && i < row.getChildCount(); i++) { final View child = row.getChildAt(i); + if (child == null) { + continue; + } final ContactEntry entry = list.get(i); final long itemId = mContactTileAdapter.getAdjustedItemId(entry.id); if (DEBUG) { -- cgit v1.2.3