@@ -317,18 +317,16 @@ private void drawForVerticalOrientation(@NonNull Canvas canvas, @NonNull Recycle
317317 left += isRtl ? insetEnd : insetStart ;
318318 right -= isRtl ? insetStart : insetEnd ;
319319
320- int itemCount = parent .getAdapter () == null ? 0 : parent . getAdapter (). getItemCount ();
321- int dividerCount = lastItemDecorated ? itemCount : itemCount - 1 ;
320+ int childCount = parent .getChildCount ();
321+ int dividerCount = lastItemDecorated ? childCount : childCount - 1 ;
322322 for (int i = 0 ; i < dividerCount ; i ++) {
323323 View child = parent .getChildAt (i );
324- if (child != null ) {
325- parent .getDecoratedBoundsWithMargins (child , tempRect );
326- // Take into consideration any translationY added to the view.
327- int bottom = tempRect .bottom + Math .round (child .getTranslationY ());
328- int top = bottom - dividerDrawable .getIntrinsicHeight () - thickness ;
329- dividerDrawable .setBounds (left , top , right , bottom );
330- dividerDrawable .draw (canvas );
331- }
324+ parent .getDecoratedBoundsWithMargins (child , tempRect );
325+ // Take into consideration any translationY added to the view.
326+ int bottom = tempRect .bottom + Math .round (child .getTranslationY ());
327+ int top = bottom - dividerDrawable .getIntrinsicHeight () - thickness ;
328+ dividerDrawable .setBounds (left , top , right , bottom );
329+ dividerDrawable .draw (canvas );
332330 }
333331 canvas .restore ();
334332 }
0 commit comments