Fix JSON parse exception
This commit is contained in:
parent
007ed19d97
commit
0c9fc5cba6
|
@ -60,6 +60,9 @@ public class Cam4Model extends AbstractModel {
|
||||||
Response response = site.getHttpClient().execute(req);
|
Response response = site.getHttpClient().execute(req);
|
||||||
if(response.isSuccessful()) {
|
if(response.isSuccessful()) {
|
||||||
JSONArray json = new JSONArray(response.body().string());
|
JSONArray json = new JSONArray(response.body().string());
|
||||||
|
if(json.length() == 0) {
|
||||||
|
throw new IOException("Couldn't fetch model details");
|
||||||
|
}
|
||||||
JSONObject details = json.getJSONObject(0);
|
JSONObject details = json.getJSONObject(0);
|
||||||
onlineState = details.getString("showType");
|
onlineState = details.getString("showType");
|
||||||
playlistUrl = details.getString("hlsPreviewUrl");
|
playlistUrl = details.getString("hlsPreviewUrl");
|
||||||
|
|
Loading…
Reference in New Issue