mirror of
https://codeberg.org/anoncontributorxmr/mysu.git
synced 2024-11-12 22:23:32 +01:00
add null check and display custom nodes first
This commit is contained in:
parent
4657132067
commit
e197cc038d
@ -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 New Issue
Block a user