forked from j62/ctbrec
1
0
Fork 0

Fix JSON exception in isOnline

This commit is contained in:
0xboobface 2019-04-17 14:37:47 +02:00
parent 204eb99b29
commit 2d048369a1
1 changed files with 6 additions and 2 deletions

View File

@ -67,8 +67,12 @@ public class Flirt4FreeModel extends AbstractModel {
.build();
try(Response response = getSite().getHttpClient().execute(request)) {
if(response.isSuccessful()) {
JSONObject json = new JSONObject(response.body().string());
//LOG.debug("check model status: {}", json.toString(2));
String body = response.body().string();
if(body.trim().isEmpty()) {
return false;
}
JSONObject json = new JSONObject(body);
//LOG.debug("check model status: ", json.toString(2));
online = Objects.equals(json.optString("status"), "online");
id = json.getString("model_id");
if(online) {