refactor: avoid checking fragment is currentSelectedPosition is out of bounds

This commit is contained in:
Rohit Verma 2025-04-02 17:07:46 +05:30
parent 9002978292
commit 3842ba952f

View file

@ -388,7 +388,10 @@ class UploadActivity : BaseActivity(), UploadContract.View, UploadBaseFragment.C
fragments!!.removeAt(index) //Remove the corresponding fragment
uploadableFiles.removeAt(index) //Remove the files from the list
if(fragments!![currentSelectedPosition] !is UploadMediaDetailFragment) {
val isMediaDetailFragment = fragments!!.getOrNull(currentSelectedPosition)?.let {
it is UploadMediaDetailFragment
} ?: false
if(!isMediaDetailFragment) {
// Should hide the top card current fragment is not the media detail fragment
showHideTopCard(false)
}