Fix getNextNonEmptyFolder crash - #2123
Open
yunusey wants to merge 1 commit into
Open
Conversation
yunusey
force-pushed
the
fix-android-crash
branch
from
August 1, 2026 05:32
c5caad8 to
c569c4d
Compare
yunusey
force-pushed
the
fix-android-crash
branch
from
August 1, 2026 05:32
c569c4d to
4e20342
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Thanks for making NewsBlur!
A couple of hours ago I hit a crash on my Android phone.
NewsBlur-Crash-Logs.txt
I was going to open an issue, but the crash looked fun (stack overflows are everyone's favorite after all!), so I figured I'd try fixing it myself. Note: I know pretty much no Kotlin.
The production trace is obfuscated, so I built a debug APK and reproduced it on Waydroid. A few log statements later, the bug showed up in
getNextNonEmptyFolder.When no folder has any unread feeds under the current filter, that function never stops walking the folder list. It wraps forever and eventually blows the stack.
The fix keeps the public shape the same: the original function now calls an overload that also takes
startFolderName. It still walks the folders, but once it comes back around to the folder it started from, it returnsnull. I also added a unit test that used to throw aStackOverflowErrorbefore this change.I tried to keep the patch small. Longer term, I'd personally drop the recursion here. I'm not deep enough in Kotlin to speak to every language-level detail, but from a normal programming point of view this burns stack for no real benefit, I believe. A plain loop would be clearer and safer.