Skip to content

Commit

Permalink
fix(import-backup): check if json is not null before importing
Browse files Browse the repository at this point in the history
  • Loading branch information
LucasGGamerM committed May 8, 2024
1 parent 02c8a56 commit 95ba52b
Showing 1 changed file with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,12 @@ public void onActivityResult(int requestCode, int resultCode, Intent data){
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
Expand Down

0 comments on commit 95ba52b

Please sign in to comment.