Skip to content

Commit

Permalink
Fixed: Play Store reported a crash error when closing the tabs.
Browse files Browse the repository at this point in the history
* This error was occurring due to the user frequently clicking the close icon of the same tab, in this situation first click closes the tab, and the second immediate click again triggers the `closeTab` function but recyclerView does not have the valid view for this position because it is in removing process so this makes this view invalid and recyclerView returns the `-1` index for invalid views. So this was the reason for this issue, to address this issue we have added a check in our `closeTab` method if the incoming index is `-1` then it will not execute the further code.
  • Loading branch information
MohitMaliDeveloper authored and kelson42 committed Apr 16, 2024
1 parent 4ccaca5 commit 1b8343b
Showing 1 changed file with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1198,6 +1198,10 @@ abstract class CoreReaderFragment :
if (currentTtsWebViewIndex == index) {
onReadAloudStop()
}
// Check if the index is valid; RecyclerView gives the index -1 for already removed views.
// Address those issues when the user frequently clicks on the close icon of the same tab.
// See https://github.com/kiwix/kiwix-android/issues/3790 for more details.
if (index == RecyclerView.NO_POSITION) return
tempZimFileForUndo = zimReaderContainer?.zimFile
tempWebViewForUndo = webViewList[index]
webViewList.removeAt(index)
Expand Down

0 comments on commit 1b8343b

Please sign in to comment.