forked from j62/ctbrec
1
0
Fork 0

Ignore models without username in JSON response

Fix for #120
There are objects in the JSON response, which don't look like regular model
entries. If an object doesn't have a username, ignore it.
This commit is contained in:
0xboobface 2018-12-15 13:18:15 +01:00
parent e1c16cda9b
commit 465e417b6c
1 changed files with 4 additions and 1 deletions

View File

@ -56,7 +56,10 @@ public class BongaCamsUpdateService extends PaginatedScheduledService {
JSONArray _models = json.getJSONArray("models");
for (int i = 0; i < _models.length(); i++) {
JSONObject m = _models.getJSONObject(i);
String name = m.getString("username");
String name = m.optString("username");
if(name.isEmpty()) {
continue;
}
BongaCamsModel model = (BongaCamsModel) bongaCams.createModel(name);
boolean away = m.optBoolean("is_away");
boolean online = m.optBoolean("online");