mirror of
https://codeberg.org/anoncontributorxmr/mysu.git
synced 2024-11-25 08:52:28 +00:00
add null check and display custom nodes first
This commit is contained in:
parent
4657132067
commit
e197cc038d
1 changed files with 6 additions and 4 deletions
|
@ -58,21 +58,23 @@ public class NodeSelectionBottomSheetDialog extends BottomSheetDialogFragment im
|
||||||
dismiss();
|
dismiss();
|
||||||
});
|
});
|
||||||
|
|
||||||
for(DefaultNodes defaultNode : DefaultNodes.values()) {
|
|
||||||
nodes.add(Node.fromString(defaultNode.getUri()));
|
|
||||||
}
|
|
||||||
try {
|
try {
|
||||||
String nodesArray = PrefService.getInstance().getString(Constants.PREF_CUSTOM_NODES, "[]");
|
String nodesArray = PrefService.getInstance().getString(Constants.PREF_CUSTOM_NODES, "[]");
|
||||||
JSONArray jsonArray = new JSONArray(nodesArray);
|
JSONArray jsonArray = new JSONArray(nodesArray);
|
||||||
for(int i = 0; i < jsonArray.length(); i++) {
|
for(int i = 0; i < jsonArray.length(); i++) {
|
||||||
String nodeString = jsonArray.getString(i);
|
String nodeString = jsonArray.getString(i);
|
||||||
Node node = Node.fromString(nodeString);
|
Node node = Node.fromString(nodeString);
|
||||||
nodes.add(node);
|
if(node != null) {
|
||||||
|
nodes.add(node);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for(DefaultNodes defaultNode : DefaultNodes.values()) {
|
||||||
|
nodes.add(Node.fromString(defaultNode.getUri()));
|
||||||
|
}
|
||||||
adapter.submitList(nodes);
|
adapter.submitList(nodes);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue