Fix sonar warning

This commit is contained in:
GGAutomaton 2022-04-16 12:44:24 +08:00
parent c24aed054f
commit bd1aae8d66
1 changed files with 6 additions and 10 deletions

View File

@ -446,13 +446,11 @@ public final class BookmarkFragment extends BaseLocalListFragment<List<PlaylistL
final Long databaseIndex = displayIndexInDatabase.remove(key);
// The database index should not be null because inserting new item into database
// is not dealt here. NullPointerException has occurred once, but I can't reproduce
// it. Enhance robustness here.
if (databaseIndex != null) {
if (databaseIndex != i) {
// is not handled here. NullPointerException has occurred once, but I can't
// reproduce it. Enhance robustness here.
if (databaseIndex != null && databaseIndex != i) {
localItemsUpdate.add((PlaylistMetadataEntry) item);
}
}
} else if (item instanceof PlaylistRemoteEntity) {
((PlaylistRemoteEntity) item).setDisplayIndex(i);
@ -461,13 +459,11 @@ public final class BookmarkFragment extends BaseLocalListFragment<List<PlaylistL
LocalItem.LocalItemType.PLAYLIST_REMOTE_ITEM);
final Long databaseIndex = displayIndexInDatabase.remove(key);
if (databaseIndex != null) {
if (databaseIndex != i) {
if (databaseIndex != null && databaseIndex != i) {
remoteItemsUpdate.add((PlaylistRemoteEntity) item);
}
}
}
}
// Find deleted items
for (final Pair<Long, LocalItem.LocalItemType> key : displayIndexInDatabase.keySet()) {