crash fixes

This commit is contained in:
Yuriy Liskov
2025-05-29 11:27:38 +03:00
parent 6414ed09b2
commit de033bcecc
2 changed files with 8 additions and 2 deletions

View File

@@ -2282,9 +2282,10 @@ final class GridLayoutManager extends RecyclerView.LayoutManager {
// MOD: fix RecycleView crash on Ugoos
try {
fastRelayout();
} catch (IllegalArgumentException | IllegalStateException e) {
} catch (IllegalArgumentException | IllegalStateException | NullPointerException e) {
// IllegalArgumentException: Called attach on a child which is not detached: ViewHolder{434061b0 position=10 id=-1, oldPos=-1, pLpos:-1 no parent}
// IllegalStateException: Layout state should be one of 100 but it is 10
// NullPointerException: Attempt to read from field 'int androidx.recyclerview.widget.ViewInfoStore$InfoRecord.flags' on a null object reference
e.printStackTrace();
}
} else {

View File

@@ -123,7 +123,12 @@ public class VideoGroupObjectAdapter extends ObjectAdapter {
int begin = mVideoItems.size();
if (mVideoGroups.contains(group)) {
mVideoItems.addAll(group.getVideos().subList(begin, group.getVideos().size()));
int end = group.getVideos().size();
if (begin > end) {
mVideoItems.addAll(group.getVideos());
} else {
mVideoItems.addAll(group.getVideos().subList(begin, end));
}
} else {
mVideoItems.addAll(group.getVideos());
mVideoGroups.add(group);