Skip to content

Commit

Permalink
Rclone: fix missing JSON property detection
Browse files Browse the repository at this point in the history
Ref: Appcenter #515743623
  • Loading branch information
x0b committed Jul 9, 2021
1 parent 96e0b16 commit 9dee1f6
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions app/src/main/java/ca/pkay/rcloneexplorer/Rclone.java
Original file line number Diff line number Diff line change
Expand Up @@ -364,8 +364,8 @@ private RemoteItem getRemoteType(JSONObject remotesJSON, RemoteItem remoteItem,

try {
JSONObject remoteJSON = new JSONObject(remotesJSON.get(key).toString());
String type = remoteJSON.getString("type");
if (type == null || type.trim().isEmpty()) {
String type = remoteJSON.optString("type");
if (type.trim().isEmpty()) {
return null;
}

Expand All @@ -385,8 +385,8 @@ private RemoteItem getRemoteType(JSONObject remotesJSON, RemoteItem remoteItem,
}

if (recurse && maxDepth > 0) {
String remote = remoteJSON.getString("remote");
if (remote == null || (!remote.contains(":") && !remote.startsWith("/"))) {
String remote = remoteJSON.optString("remote");
if (remote.trim().isEmpty() || (!remote.contains(":") && !remote.startsWith("/"))) {
return null;
}

Expand Down

0 comments on commit 9dee1f6

Please sign in to comment.