mirror of
https://codeberg.org/anoncontributorxmr/mysu.git
synced 2024-11-25 17:02:28 +00:00
Cleanup and add comment
This commit is contained in:
parent
9e70f64e39
commit
f95683aed2
2 changed files with 12 additions and 6 deletions
|
@ -73,6 +73,7 @@ public class NodeSelectionBottomSheetDialog extends BottomSheetDialogFragment im
|
|||
}
|
||||
}
|
||||
} catch (JSONException e) {
|
||||
// if stored node is old string format, try parse and upgrade, if fail then remove
|
||||
try {
|
||||
String nodeString = jsonArray.getString(i);
|
||||
Node node = Node.fromString(nodeString);
|
||||
|
|
|
@ -45,6 +45,12 @@ public class PrefService extends ServiceBase {
|
|||
JSONObject nodeJson = new JSONObject(nodeString);
|
||||
return Node.fromJson(nodeJson);
|
||||
} catch (JSONException e) {
|
||||
// stored node is not json format, upgrade if possible
|
||||
return upgradeOldNode(nodeString);
|
||||
}
|
||||
}
|
||||
|
||||
private Node upgradeOldNode(String nodeString) {
|
||||
if(!nodeString.isEmpty()) {
|
||||
Node node = Node.fromString(nodeString);
|
||||
if(node != null) {
|
||||
|
@ -52,7 +58,6 @@ public class PrefService extends ServiceBase {
|
|||
return node;
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue