-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
BugFix - NPE internalFolderSyncTimestamp & File Existence Check #13612
base: master
Are you sure you want to change the base?
Conversation
Thank you! This fixed it for me. |
8b43e4f
to
d81ddfd
Compare
app/src/main/java/com/nextcloud/client/jobs/InternalTwoWaySyncWork.kt
Outdated
Show resolved
Hide resolved
d81ddfd
to
26cbf21
Compare
Draft or ready to review? 🙈 |
@tobiasKaminsky We have to test two-way sync properly before merge this PR, so it's a draft. |
26cbf21
to
7c00ab2
Compare
7c00ab2
to
b4b7c30
Compare
@@ -89,6 +81,25 @@ class InternalTwoWaySyncWork( | |||
} | |||
} | |||
|
|||
private fun checkFreeSpace(folder:OCFile): Result? { | |||
folder.storagePath?.let { storagePath -> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If folder does not yet exist, we can still compute it:
- localFolderSize is 0, as nothing was downloaded yet
Rest of computation would then still apply.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the file does not exist, freeSpaceLeft
will be 0 because file.getFreeSpace()
will return 0.
Therefore, the condition if (freeSpaceLeft < (remoteFolderSize - localFolderSize))
will evaluate to true, as 0 < some_value - 0
is always true, causing the worker to be canceled. I assume remoteFolderSize going to be bigger than 0.
0ec1a97
to
b071684
Compare
…ullable value Signed-off-by: alperozturk <alper_ozturk@proton.me>
Signed-off-by: alperozturk <alper_ozturk@proton.me>
Signed-off-by: alperozturk <alper_ozturk@proton.me>
Signed-off-by: alperozturk <alper_ozturk@proton.me>
Signed-off-by: alperozturk <alper_ozturk@proton.me>
Signed-off-by: alperozturk <alper_ozturk@proton.me>
Signed-off-by: alperozturk <alper_ozturk@proton.me>
160a6ca
to
51fbb8f
Compare
APK file: https://www.kaminsky.me/nc-dev/android-artifacts/13612.apk |
Changes
During my tests, I wasn’t able to reproduce the issue; however, some users with version 3.30.0 Final have already experienced the crash. It means some OCFile already saved into the internal storage via null value.
Potential fix could be in this PR:
Changing following set function, but I’m not sure.
ocFile.setInternalFolderSyncTimestamp(fileEntity.getInternalTwoWaySync()); ->
ocFile.setInternalFolderSyncTimestamp(nullToZero(fileEntity.getInternalTwoWaySync()));
To prevent further crashes, I checked nullability of the Long object and return non-null object. Alternative solution can be we can convert the Long object to long primitive type.