-
-
Notifications
You must be signed in to change notification settings - Fork 464
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixed: Application crashes when opening the random article. #4162
base: main
Are you sure you want to change the base?
Conversation
36f9be8
to
179061c
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #4162 +/- ##
============================================
- Coverage 56.93% 56.79% -0.15%
+ Complexity 1518 1516 -2
============================================
Files 313 313
Lines 13402 13413 +11
Branches 1666 1668 +2
============================================
- Hits 7631 7618 -13
- Misses 4614 4650 +36
+ Partials 1157 1145 -12 ☔ View full report in Codecov by Sentry. |
@MohitMaliFtechiz Why the reader handle should be or is null? If there is a valid scenario, then we should have a generoc function trsting this and this should be builtin in the ZIM reader class at all places where needed. I don't understand why such a basic thing is done at such a high level!? |
@kelson42 No it will not be null if there is a ZIM file opened in the reader. The controls are disabled until the ZIM file is not loaded into the webView. Actually, the error occurs when we are copying/moving the split ZIM file so after copying/moving the ZIM file it tries to open the ZIM file in the reader but currently, it is corrupted since all ZIM chunks are not copied and the reader showing invalid ZIm file. But at this moment, menu controls are enabled for this ZIM and the user tries to open the random article, so in this condition, the reader was null, and openRandomArticle was going into an infinite loop. I have placed a fix for it and updated the videos on the PR description. |
…rticle. * Fixed an issue where the app would enter an infinite loop when the zimFileReader was null, causing a crash. * Improved the condition to check if zimFileReader is null and show a proper error message to the user without retrying. * Added a retry mechanism to attempt fetching the random article twice in case of an internal error in libzim. * After two failed attempts, an error message is displayed to the user if the random article is not found.
… to crash. * The issue occurred in the Play Store variant, specifically with the copy/move functionality for ZIM files. After copying or moving a ZIM file, the application attempts to open it in the reader. However, if the application tries to open a split ZIM file with only one chunk, it throws an error indicating that the file is not a valid ZIM file (which is expected, as not all ZIM chunks have been copied/moved). When this error occurs, the menu buttons remain enabled, allowing the user to interact with them. If the user then attempts to open a random article, the application enters an infinite loop and crashes. To resolve this, we now disable the menu controls whenever an error occurs while opening a ZIM file, preventing the user from using them in such scenarios.
f9afbe8
to
cdafdba
Compare
The Ci is failing due to #4169. |
Fixes #4161
Before fix
screen-20250108-154820.mp4
After fix
screen-20250108-152814.mp4