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,7 +158,7 @@ class FlagsDialog extends AModuleDialog {
private void initGroups() {
String fileString = new InternalFile(FlagsConfig.CONF_FILE, getActivity()).get();
groups = null;
groups = new JSONObject();
if (fileString != null) {
try {
groups = new JSONObject(fileString).getJSONObject("groups");
@ -236,9 +236,11 @@ class FlagsDialog extends AModuleDialog {
}
void updateMoreIndicator() {
overflowButton.setImageResource(hiddenFlagsVG.getChildCount() == 0 ? 0
: hiddenFlagsAndSearchVG.getVisibility() == View.VISIBLE ? R.drawable.arrow_down
: R.drawable.arrow_right);
if (hiddenFlagsVG.getChildCount() == 0) {
overflowButton.setImageDrawable(null);
} else {
overflowButton.setImageResource(hiddenFlagsVG.getVisibility() == View.VISIBLE ? R.drawable.arrow_down : R.drawable.arrow_right);
}
}
/**