Fix some crashes
This commit is contained in:
parent
2f909d5ffa
commit
c4c745dbc0
|
@ -235,14 +235,17 @@ public class PeertubeAPI {
|
|||
e.printStackTrace();
|
||||
}
|
||||
} else {
|
||||
if (!resobj.has("name")) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
try {
|
||||
peertube.setId(resobj.getString("id"));
|
||||
peertube.setCache(resobj);
|
||||
if (resobj.has("uuid")) {
|
||||
peertube.setUuid(resobj.getString("uuid"));
|
||||
}
|
||||
|
||||
peertube.setName(resobj.getString("name"));
|
||||
peertube.setDescription(resobj.getString("description"));
|
||||
peertube.setEmbedPath(resobj.getString("embedPath"));
|
||||
|
@ -272,11 +275,16 @@ public class PeertubeAPI {
|
|||
LinkedHashMap<Integer, String> category = new LinkedHashMap<>();
|
||||
LinkedHashMap<Integer, String> license = new LinkedHashMap<>();
|
||||
LinkedHashMap<Integer, String> privacy = new LinkedHashMap<>();
|
||||
category.put(resobj.getJSONObject("category").getInt("id"), resobj.getJSONObject("category").getString("label"));
|
||||
|
||||
if (!resobj.getJSONObject("category").isNull("id")) {
|
||||
license.put(resobj.getJSONObject("category").getInt("id"), resobj.getJSONObject("category").getString("label"));
|
||||
} else {
|
||||
license.put(1, resobj.getJSONObject("category").getString("label"));
|
||||
}
|
||||
if (!resobj.getJSONObject("licence").isNull("id")) {
|
||||
license.put(resobj.getJSONObject("licence").getInt("id"), resobj.getJSONObject("licence").getString("label"));
|
||||
} else {
|
||||
license.put(1, "Unknown");
|
||||
license.put(1, resobj.getJSONObject("licence").getString("label"));
|
||||
}
|
||||
privacy.put(resobj.getJSONObject("privacy").getInt("id"), resobj.getJSONObject("privacy").getString("label"));
|
||||
langue.put(resobj.getJSONObject("language").getString("id"), resobj.getJSONObject("language").getString("label"));
|
||||
|
@ -284,7 +292,8 @@ public class PeertubeAPI {
|
|||
peertube.setLicense(license);
|
||||
peertube.setLanguage(langue);
|
||||
peertube.setPrivacy(privacy);
|
||||
} catch (Exception ignored) {
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
} catch (JSONException e) {
|
||||
e.printStackTrace();
|
||||
|
|
Loading…
Reference in New Issue