Conversation
|
Warning Rate limit exceeded
⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. 📝 WalkthroughWalkthroughAdds two private initializer helpers in TermuxActivity to ensure TermuxAppSharedProperties and TermuxShellManager singletons are initialized; calls added in onCreate() and onServiceConnected() to avoid null references during restoration and service binding. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@termux/termux-app/src/main/java/com/termux/app/TermuxActivity.java`:
- Around line 449-456: The method ensureTermuxPropertiesInitialized() in
TermuxActivity has an extraneous trailing semicolon after its closing brace
which causes a compile error; remove the stray semicolon following the method
block so the class body is valid Java (locate the
ensureTermuxPropertiesInitialized() method and delete the final ";" after its
closing brace).
termux/termux-app/src/main/java/com/termux/app/TermuxActivity.java
Outdated
Show resolved
Hide resolved
49e6de3 to
f56c797
Compare
6a41f02 to
4af7dcd
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@termux/termux-app/src/main/java/com/termux/app/TermuxActivity.java`:
- Around line 211-212: In TermuxService.onCreate(), guard against a null
TermuxShellManager by checking getShellManager() (and/or the field mShellManager
set by ensureTermuxShellManagerInitialized()) before using it; if it is null
either postpone initialization (e.g., schedule a retry/handler) or throw a clear
IllegalStateException with a descriptive message indicating Direct
Boot/CredentialProtectedApplicationLoader timing, so calls that follow
(references to mShellManager) never dereference a null object; update
ensureTermuxShellManagerInitialized()/onCreate() to perform this null-check and
handle the null case explicitly.
a6668da to
fadfd4c
Compare
Prevent NPEs in TermuxActivity and TermuxService by initializing properties and shell manager.
031bf7f to
ccf61f0
Compare
Description
This PR fixes critical crashes that occur when the application process is killed by the system (e.g., due to memory pressure or "Don't keep activities" developer setting) and subsequently restored.
In these scenarios, the static singletons for
TermuxAppSharedPropertiesandTermuxShellManagerwere null, leading toNullPointerExceptioncrashes inTermuxActivity(when loading properties) andTermuxService(when accessing session lists). I have added defensive initialization methods (ensureTermuxPropertiesInitializedandensureTermuxShellManagerInitialized) inonCreateto ensure these components are ready before use.Details
Crash 1 (Activity):
java.lang.NullPointerException: Attempt to invoke virtual method 'void ...TermuxAppSharedProperties.loadTermuxPropertiesFromDisk()' on a null object referenceCrash 2 (Service):
java.lang.NullPointerException: Attempt to read from field 'java.util.List ...TermuxShellManager.mTermuxSessions' on a null object referenceBefore changes
Screen.Recording.2026-01-26.at.12.16.21.PM.mov
After changes
Screen.Recording.2026-01-26.at.5.04.13.PM.mov
Ticket
Observation
The initialization uses the
applicationContextto prevent memory leaks and employs an early-return pattern for cleaner readability.