Skip to content

Commit bd1aae8

Browse files
committed
Fix sonar warning
1 parent c24aed0 commit bd1aae8

1 file changed

Lines changed: 6 additions & 10 deletions

File tree

app/src/main/java/org/schabi/newpipe/local/bookmark/BookmarkFragment.java

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -446,12 +446,10 @@ private void saveImmediate() {
446446
final Long databaseIndex = displayIndexInDatabase.remove(key);
447447

448448
// The database index should not be null because inserting new item into database
449-
// is not dealt here. NullPointerException has occurred once, but I can't reproduce
450-
// it. Enhance robustness here.
451-
if (databaseIndex != null) {
452-
if (databaseIndex != i) {
453-
localItemsUpdate.add((PlaylistMetadataEntry) item);
454-
}
449+
// is not handled here. NullPointerException has occurred once, but I can't
450+
// reproduce it. Enhance robustness here.
451+
if (databaseIndex != null && databaseIndex != i) {
452+
localItemsUpdate.add((PlaylistMetadataEntry) item);
455453
}
456454
} else if (item instanceof PlaylistRemoteEntity) {
457455
((PlaylistRemoteEntity) item).setDisplayIndex(i);
@@ -461,10 +459,8 @@ private void saveImmediate() {
461459
LocalItem.LocalItemType.PLAYLIST_REMOTE_ITEM);
462460
final Long databaseIndex = displayIndexInDatabase.remove(key);
463461

464-
if (databaseIndex != null) {
465-
if (databaseIndex != i) {
466-
remoteItemsUpdate.add((PlaylistRemoteEntity) item);
467-
}
462+
if (databaseIndex != null && databaseIndex != i) {
463+
remoteItemsUpdate.add((PlaylistRemoteEntity) item);
468464
}
469465
}
470466
}

0 commit comments

Comments
 (0)