From 90be7e66b1e2f959b771784cbf963a3ac6c66b20 Mon Sep 17 00:00:00 2001 From: alperozturk Date: Tue, 24 Sep 2024 10:57:09 +0200 Subject: [PATCH] dont let setInternalFolderSyncTimestamp via null value, dont return nullable value Signed-off-by: alperozturk --- .../owncloud/android/datamodel/FileDataStorageManager.java | 2 +- .../main/java/com/owncloud/android/datamodel/OCFile.java | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/com/owncloud/android/datamodel/FileDataStorageManager.java b/app/src/main/java/com/owncloud/android/datamodel/FileDataStorageManager.java index 3e14f01852..b02fdc257e 100644 --- a/app/src/main/java/com/owncloud/android/datamodel/FileDataStorageManager.java +++ b/app/src/main/java/com/owncloud/android/datamodel/FileDataStorageManager.java @@ -1125,7 +1125,7 @@ public class FileDataStorageManager { ocFile.setLivePhoto(fileEntity.getMetadataLivePhoto()); ocFile.setHidden(nullToZero(fileEntity.getHidden()) == 1); ocFile.setE2eCounter(fileEntity.getE2eCounter()); - ocFile.setInternalFolderSyncTimestamp(fileEntity.getInternalTwoWaySync()); + ocFile.setInternalFolderSyncTimestamp(nullToZero(fileEntity.getInternalTwoWaySync())); String sharees = fileEntity.getSharees(); // Surprisingly JSON deserialization causes significant overhead. diff --git a/app/src/main/java/com/owncloud/android/datamodel/OCFile.java b/app/src/main/java/com/owncloud/android/datamodel/OCFile.java index b1d9ce2e8c..e36bc97f29 100644 --- a/app/src/main/java/com/owncloud/android/datamodel/OCFile.java +++ b/app/src/main/java/com/owncloud/android/datamodel/OCFile.java @@ -1076,11 +1076,15 @@ public class OCFile implements Parcelable, Comparable, ServerFileInterfa } public boolean isInternalFolderSync() { + if (internalFolderSyncTimestamp == null) { + return false; + } + return internalFolderSyncTimestamp >= 0; } public Long getInternalFolderSyncTimestamp() { - return internalFolderSyncTimestamp; + return Objects.requireNonNullElse(internalFolderSyncTimestamp, -1L); } public void setInternalFolderSyncTimestamp(Long internalFolderSyncTimestamp) {