Skip to content

Commit ac903bb

Browse files
committed
GetCapabilitiesRemoteOperation: prevent error if PROPERTY_KEYS_EXIST does not exist
Signed-off-by: Álvaro Brey <[email protected]>
1 parent 7341e46 commit ac903bb

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

library/src/main/java/com/owncloud/android/lib/resources/status/GetCapabilitiesRemoteOperation.java

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -560,12 +560,18 @@ private OCCapability parseResponse(String response) throws JSONException {
560560
capability.setEndToEndEncryption(CapabilityBooleanType.FALSE);
561561
}
562562

563-
if (respEndToEndEncryption.getBoolean(PROPERTY_KEYS_EXIST)) {
564-
capability.setEndToEndEncryptionKeysExist(CapabilityBooleanType.TRUE);
563+
if (respEndToEndEncryption.has(PROPERTY_KEYS_EXIST)) {
564+
final boolean keysExist = respEndToEndEncryption.getBoolean(PROPERTY_KEYS_EXIST);
565+
if (keysExist) {
566+
capability.setEndToEndEncryptionKeysExist(CapabilityBooleanType.TRUE);
567+
} else {
568+
capability.setEndToEndEncryptionKeysExist(CapabilityBooleanType.FALSE);
569+
}
565570
} else {
566-
capability.setEndToEndEncryptionKeysExist(CapabilityBooleanType.FALSE);
571+
capability.setEndToEndEncryptionKeysExist(CapabilityBooleanType.UNKNOWN);
567572
}
568573

574+
569575
Log_OC.d(TAG, "*** Added " + NODE_END_TO_END_ENCRYPTION);
570576
}
571577

0 commit comments

Comments
 (0)