mirror of
https://github.com/nextcloud/android.git
synced 2024-11-23 21:55:48 +03:00
findbug: SUI_CONTAINS_BEFORE_REMOVE: Method checks for an item in a set with contains, before using remove()
Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
This commit is contained in:
parent
e1feb49fe1
commit
5b6ad9add1
1 changed files with 2 additions and 4 deletions
|
@ -154,10 +154,9 @@ public class PreviewImagePagerAdapter extends FragmentStatePagerAdapter {
|
||||||
} else if (file.isDown()) {
|
} else if (file.isDown()) {
|
||||||
fragment = PreviewImageFragment.newInstance(file, mObsoletePositions.contains(i), false);
|
fragment = PreviewImageFragment.newInstance(file, mObsoletePositions.contains(i), false);
|
||||||
} else {
|
} else {
|
||||||
if (mDownloadErrors.contains(i)) {
|
if (mDownloadErrors.remove(i)) {
|
||||||
fragment = FileDownloadFragment.newInstance(file, mAccount, true);
|
fragment = FileDownloadFragment.newInstance(file, mAccount, true);
|
||||||
((FileDownloadFragment) fragment).setError(true);
|
((FileDownloadFragment) fragment).setError(true);
|
||||||
mDownloadErrors.remove(i);
|
|
||||||
} else {
|
} else {
|
||||||
if (file.isEncrypted()) {
|
if (file.isEncrypted()) {
|
||||||
fragment = FileDownloadFragment.newInstance(file, mAccount, mObsoletePositions.contains(i));
|
fragment = FileDownloadFragment.newInstance(file, mAccount, mObsoletePositions.contains(i));
|
||||||
|
@ -212,8 +211,7 @@ public class PreviewImagePagerAdapter extends FragmentStatePagerAdapter {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getItemPosition(@NonNull Object object) {
|
public int getItemPosition(@NonNull Object object) {
|
||||||
if (mObsoleteFragments.contains(object)) {
|
if (mObsoleteFragments.remove(object)) {
|
||||||
mObsoleteFragments.remove(object);
|
|
||||||
return POSITION_NONE;
|
return POSITION_NONE;
|
||||||
}
|
}
|
||||||
return super.getItemPosition(object);
|
return super.getItemPosition(object);
|
||||||
|
|
Loading…
Reference in a new issue