Fix sonar warning
This commit is contained in:
parent
c24aed054f
commit
bd1aae8d66
1 changed files with 6 additions and 10 deletions
|
@ -446,13 +446,11 @@ public final class BookmarkFragment extends BaseLocalListFragment<List<PlaylistL
|
||||||
final Long databaseIndex = displayIndexInDatabase.remove(key);
|
final Long databaseIndex = displayIndexInDatabase.remove(key);
|
||||||
|
|
||||||
// The database index should not be null because inserting new item into database
|
// 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
|
// is not handled here. NullPointerException has occurred once, but I can't
|
||||||
// it. Enhance robustness here.
|
// reproduce it. Enhance robustness here.
|
||||||
if (databaseIndex != null) {
|
if (databaseIndex != null && databaseIndex != i) {
|
||||||
if (databaseIndex != i) {
|
|
||||||
localItemsUpdate.add((PlaylistMetadataEntry) item);
|
localItemsUpdate.add((PlaylistMetadataEntry) item);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
} else if (item instanceof PlaylistRemoteEntity) {
|
} else if (item instanceof PlaylistRemoteEntity) {
|
||||||
((PlaylistRemoteEntity) item).setDisplayIndex(i);
|
((PlaylistRemoteEntity) item).setDisplayIndex(i);
|
||||||
|
|
||||||
|
@ -461,13 +459,11 @@ public final class BookmarkFragment extends BaseLocalListFragment<List<PlaylistL
|
||||||
LocalItem.LocalItemType.PLAYLIST_REMOTE_ITEM);
|
LocalItem.LocalItemType.PLAYLIST_REMOTE_ITEM);
|
||||||
final Long databaseIndex = displayIndexInDatabase.remove(key);
|
final Long databaseIndex = displayIndexInDatabase.remove(key);
|
||||||
|
|
||||||
if (databaseIndex != null) {
|
if (databaseIndex != null && databaseIndex != i) {
|
||||||
if (databaseIndex != i) {
|
|
||||||
remoteItemsUpdate.add((PlaylistRemoteEntity) item);
|
remoteItemsUpdate.add((PlaylistRemoteEntity) item);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// Find deleted items
|
// Find deleted items
|
||||||
for (final Pair<Long, LocalItem.LocalItemType> key : displayIndexInDatabase.keySet()) {
|
for (final Pair<Long, LocalItem.LocalItemType> key : displayIndexInDatabase.keySet()) {
|
||||||
|
|
Loading…
Reference in a new issue