From a6fce20e952857dd38851a7f5ee0a9c035333762 Mon Sep 17 00:00:00 2001 From: AndyScherzinger Date: Mon, 9 Apr 2018 23:14:39 +0200 Subject: [PATCH 1/2] Fix #2439 NPE via null check --- .../com/owncloud/android/operations/UploadFileOperation.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/owncloud/android/operations/UploadFileOperation.java b/src/main/java/com/owncloud/android/operations/UploadFileOperation.java index e9a594df095a..ae0faa527798 100644 --- a/src/main/java/com/owncloud/android/operations/UploadFileOperation.java +++ b/src/main/java/com/owncloud/android/operations/UploadFileOperation.java @@ -396,7 +396,7 @@ protected RemoteOperationResult run(OwnCloudClient client) { // try to unlock folder with stored token, e.g. when upload needs to be resumed or app crashed // the parent folder should exist as it is a resume of a broken upload - if (!mFolderUnlockToken.isEmpty()) { + if (mFolderUnlockToken != null && !mFolderUnlockToken.isEmpty()) { UnlockFileOperation unlockFileOperation = new UnlockFileOperation(parent.getLocalId(), mFolderUnlockToken); RemoteOperationResult unlockFileOperationResult = unlockFileOperation.execute(client, true); From b8ad5fea7b358e228b08e04024f5139b48bbec56 Mon Sep 17 00:00:00 2001 From: tobiasKaminsky Date: Tue, 10 Apr 2018 10:45:41 +0200 Subject: [PATCH 2/2] add another NPE check Signed-off-by: tobiasKaminsky --- .../com/owncloud/android/operations/UploadFileOperation.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/owncloud/android/operations/UploadFileOperation.java b/src/main/java/com/owncloud/android/operations/UploadFileOperation.java index ae0faa527798..32300cf2f75f 100644 --- a/src/main/java/com/owncloud/android/operations/UploadFileOperation.java +++ b/src/main/java/com/owncloud/android/operations/UploadFileOperation.java @@ -373,7 +373,7 @@ protected RemoteOperationResult run(OwnCloudClient client) { OCFile parent = getStorageManager().getFileByPath(remoteParentPath); // in case of a fresh upload with subfolder, where parent does not exist yet - if (parent == null && mFolderUnlockToken.isEmpty()) { + if (parent == null && (mFolderUnlockToken == null || mFolderUnlockToken.isEmpty())) { // try to create folder RemoteOperationResult result = grantFolderExistence(remoteParentPath, client);