Repository navigation
Conversation
1c1d6f7 to
53794f7
Compare
|
Thanks for the contribution @ibrahim-iqbal! 🙌🏻 Some notes before the CR:
Let us know if you have any doubts and we will help you! 😄 |
53794f7 to
a1f2bfe
Compare
|
Thanks for the quick review! Both done:
Ready for another look. |
There was a problem hiding this comment.
Good job @ibrahim-iqbal! Some comments about your PR
a1f2bfe to
a423e79
Compare
|
Thanks for the review, @joragua! All addressed:
Ready for another look. |
|
@ibrahim-iqbal just check the comment above and it's ready EDIT: I mean, this comment should be removed |
|
Removed, thanks — missed that one, good catch. |
joragua
left a comment
There was a problem hiding this comment.
LGTM! 💯
The branch now needs to be rebased against master before it can be merged. Please let us know if you have any problems and we will help you!
|
@ibrahim-iqbal please rebase the branch and it will be straight merged. Thanks! |
When the last account is removed (or no account exists yet), BaseActivity.swapToDefaultAccount() launches the account-setup flow but leaves the account null for the rest of the activity's lifecycle. A bottom-nav click in that window still called navigateToOption(), which eventually constructs FileDataStorageManager(account) and NPEs on the null account. Guard the three navigateToOption() call sites in DrawerActivity.bottomBarNavigationTo with a null-account check — the setup screen is already launching, so there's nothing to navigate to. The Uploads nav item is untouched since it never touches the storage manager. Signed-off-by: ibrahim-iqbal <ibrahim-iqbal@users.noreply.github.com>
Signed-off-by: ibrahim-iqbal <ibrahim-iqbal@users.noreply.github.com>
Per review: moved the account==null check to the top of bottomBarNavigationTo itself instead of a separate navigateToOptionIfAccountReady wrapper, and replaced the long AI-generated doc comment with a one-line note matching the file's existing comment style. Signed-off-by: ibrahim-iqbal <ibrahim-iqbal@users.noreply.github.com>
…onTo Same category as the earlier removed comment on navigateToOptionIfAccountReady - the guard clause is self-explanatory, the comment restated it. Signed-off-by: ibrahim-iqbal <ibrahim-iqbal@users.noreply.github.com>
5bb8a3c to
8f500b1
Compare
|
Rebased onto current |
|
Merged! thanks again @ibrahim-iqbal!! your contribution will be part of 5.0 release. |
Fixes #4998
Crash
Root cause
FileDataStorageManager's constructor takes a non-nullAccount.BaseActivity.getStorageManager()has:swapToDefaultAccount()only setsmCurrentAccountwhen a valid account is found; when none exists (e.g. the last account was just removed from the device, or the app reaches this state before onboarding), it instead callscreateAccount(true)to launch the setup flow and returns with the account stillnull. The very next line then passes that still-nullgetAccount()straight into the non-null Kotlin constructor → NPE.A bottom navigation bar click (
DrawerActivity.bottomBarNavigationTo→navigateToOption→FileDisplayActivity.navigateTo→getStorageManager()) can land in exactly that window, while the account-setup activity is launching but hasn't taken focus yet.Fix
Added a
navigateToOptionIfAccountReadywrapper inDrawerActivitythat no-ops whenaccount == null, used at the threenavigateToOptioncall sites inbottomBarNavigationTo(All Files, Spaces, Available Offline, Shared by Link). The account-setup screen is already on its way, so there's nothing useful to navigate to — silently skipping is correct instead of crashing. The Uploads nav item is untouched since it launchesUploadListActivitydirectly and never touches the storage manager.This doesn't change
getStorageManager()'s own (non-null) contract or any other caller — it stops the crash at the one site where a UI click could race the account-setup redirect.Testing
./gradlew :owncloudApp:compileOriginalDebugKotlin— compiles clean, no errors.AI assistance
Drafted with AI assistance; I reviewed every line and traced the full call chain from the stack trace in the issue to the root cause in
BaseActivity.getStorageManager().🤖 Generated with Claude Code