From c9a06fc5e43de432e7984232281d180357073ede Mon Sep 17 00:00:00 2001 From: "David A. Velasco" Date: Wed, 10 May 2017 15:34:22 +0200 Subject: [PATCH] Fix NullPointerException in update of public shares while keeping compatibility of the operation with servers not supporting 'name' property in shares --- .../lib/resources/shares/UpdateRemoteShareOperation.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/com/owncloud/android/lib/resources/shares/UpdateRemoteShareOperation.java b/src/com/owncloud/android/lib/resources/shares/UpdateRemoteShareOperation.java index 69261cd2..fa5bb3f9 100644 --- a/src/com/owncloud/android/lib/resources/shares/UpdateRemoteShareOperation.java +++ b/src/com/owncloud/android/lib/resources/shares/UpdateRemoteShareOperation.java @@ -168,7 +168,7 @@ public class UpdateRemoteShareOperation extends RemoteOperation { /// prepare array of parameters to update List> parametersToUpdate = new ArrayList<>(); - if (mName.length() > 0) { + if (mName != null) { parametersToUpdate.add(new Pair<>(PARAM_NAME, mName)); } @@ -236,7 +236,11 @@ public class UpdateRemoteShareOperation extends RemoteOperation { } else { result = new RemoteOperationResult(false, put); } - if (!result.isSuccess()) { + if (!result.isSuccess() && + !PARAM_NAME.equals(parameter.first) + // fail in "name" parameter will be ignored; requires OCX, will fail + // fails in previous versions + ) { break; } }