Merge pull request #606 from Brice-W/fix-illegalstateexception

Fix IllegalStateException
This commit is contained in:
Niels Andriesse 2021-06-17 09:32:44 +10:00 committed by GitHub
commit ac4b576abe
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -28,7 +28,7 @@ public class MediaPreviewViewModel extends ViewModel {
public void setCursor(@NonNull Context context, @Nullable Cursor cursor, boolean leftIsRecent) {
boolean firstLoad = (this.cursor == null) && (cursor != null);
if (this.cursor != null) {
if (this.cursor != null && !this.cursor.equals(cursor)) {
this.cursor.close();
}
this.cursor = cursor;