Browse Source

only cancel notification if an old file exists

Signed-off-by: tobiasKaminsky <tobias@kaminsky.me>
tobiasKaminsky 1 year ago
parent
commit
d76d16f3a9
1 changed files with 6 additions and 4 deletions
  1. 6 4
      app/src/main/java/com/nextcloud/client/jobs/FilesUploadWorker.kt

+ 6 - 4
app/src/main/java/com/nextcloud/client/jobs/FilesUploadWorker.kt

@@ -402,10 +402,12 @@ class FilesUploadWorker(
 
     private fun cancelOldErrorNotification(uploadFileOperation: UploadFileOperation) {
         // cancel for old file because of file conflicts
-        notificationManager.cancel(
-            NotificationUtils.createUploadNotificationTag(uploadFileOperation.oldFile),
-            NOTIFICATION_ERROR_ID
-        )
+        if (uploadFileOperation.oldFile != null) {
+            notificationManager.cancel(
+                NotificationUtils.createUploadNotificationTag(uploadFileOperation.oldFile),
+                NOTIFICATION_ERROR_ID
+            )
+        }
         notificationManager.cancel(
             NotificationUtils.createUploadNotificationTag(uploadFileOperation.file),
             NOTIFICATION_ERROR_ID