RobotiumTech / robotium

Android UI Testing
http://www.robotium.org
Apache License 2.0
2.86k stars 786 forks source link

Solo.getViews() may return List with nulls in it #783

Closed abutygin closed 9 years ago

abutygin commented 9 years ago

It may occur on app screens with RecyclerView. In ViewFetcher.addChildren method viewGroup.getChildAt(i) can return null. So lines:

else if(!onlySufficientlyVisible)
   views.add(child);

should be replaced by

else if(!onlySufficientlyVisible && child != null)
   views.add(child);

or check child after viewGroup.getChildAt(i) :

final View child = viewGroup.getChildAt(i);
if (child == null) 
    continue;
renas commented 9 years ago

Thanks for reporting this. We'll make a new release shortly and will include this fix in it.

renas commented 9 years ago

Fixed in 5.5.2.

abutygin commented 9 years ago

Thanks a lot!