Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions changelog/unreleased/4738
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
Bugfix: Prevent NullPointerException when returning from external-file receive screen

The share-into flow's `ReceiveExternalFilesActivity` forwarded a folder to
`ReceiveExternalFilesViewModel.refreshFolderUseCase` without guarding for null,
so any code path where `getCurrentDir()` resolved to `null` — such as leaving
the screen before the storage manager had loaded the parent folder — crashed
with a Kotlin platform-type NPE. The activity now skips the sync when the
folder cannot be resolved and logs the reason instead of crashing.

https://github.com/owncloud/android/issues/4738
Original file line number Diff line number Diff line change
Expand Up @@ -628,6 +628,14 @@ public void onSavedCertificate() {
}

private void startSyncFolderOperation(OCFile folder) {
// getCurrentDir() and other callers can hand us a null folder when the
// storage manager cannot resolve the parent path yet; forwarding that
// to the Kotlin use case would trip the platform-type null check and
// crash as reported in issue #4738.
if (folder == null) {
Timber.w("startSyncFolderOperation called with a null folder; skipping sync");
return;
}

mSyncInProgress = true;

Expand Down
Loading