forked from j62/ctbrec
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:
parent
e1c16cda9b
commit
465e417b6c
|
@ -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");
|
||||
|
|
Loading…
Reference in New Issue