0
0
mirror of https://github.com/TrianguloY/UrlChecker.git synced 2024-09-19 20:02:16 +02:00

fix nullpointer and invalid drawable

nullpointer when there is no flags configuration, groups was null and later was used
This commit is contained in:
TrianguloY 2023-04-22 14:00:26 +02:00
parent 718123bbb1
commit 03ab4b6ca5

View File

@ -158,8 +158,8 @@ class FlagsDialog extends AModuleDialog {
private void initGroups() {
String fileString = new InternalFile(FlagsConfig.CONF_FILE, getActivity()).get();
groups = null;
if (fileString != null){
groups = new JSONObject();
if (fileString != null) {
try {
groups = new JSONObject(fileString).getJSONObject("groups");
} catch (JSONException ignore) {
@ -235,10 +235,12 @@ class FlagsDialog extends AModuleDialog {
updateMoreIndicator();
}
void updateMoreIndicator(){
overflowButton.setImageResource(hiddenFlagsVG.getChildCount() == 0 ? 0
: hiddenFlagsAndSearchVG.getVisibility() == View.VISIBLE ? R.drawable.arrow_down
: R.drawable.arrow_right);
void updateMoreIndicator() {
if (hiddenFlagsVG.getChildCount() == 0) {
overflowButton.setImageDrawable(null);
} else {
overflowButton.setImageResource(hiddenFlagsVG.getVisibility() == View.VISIBLE ? R.drawable.arrow_down : R.drawable.arrow_right);
}
}
/**