fix(import-backup): check if json is not null before importing

This commit is contained in:
LucasGGamerM
2024-05-08 20:09:00 -03:00
parent 02c8a56c17
commit 95ba52b761

View File

@@ -233,6 +233,12 @@ public class SettingsAboutAppFragment extends BaseSettingsFragment<Void> impleme
String jsonString=stringBuilder.toString();
Gson gson=new GsonBuilder().setObjectToNumberStrategy(ToNumberPolicy.LONG_OR_DOUBLE).create();
//check if json is not null
if(jsonString.isEmpty()) {
throw new IOException();
}
JsonObject jsonObject=JsonParser.parseString(jsonString).getAsJsonObject();
//check if json has required attributes