News Manager silent error fix
This commit is contained in:
@@ -53,10 +53,19 @@ public class NewsManager {
|
||||
|
||||
for (int i = news.length() - 1; i >= 0; i--) {
|
||||
try {
|
||||
String title = news.getJSONObject(i).getString("title_" + language);
|
||||
//noinspection ConstantConditions
|
||||
if (title == null)
|
||||
String title;
|
||||
if (news.getJSONObject(i).has("title_" + language)) {
|
||||
title = news.getJSONObject(i).getString("title_" + language);
|
||||
} else {
|
||||
title = news.getJSONObject(i).getString("title");
|
||||
}
|
||||
String text;
|
||||
if (news.getJSONObject(i).has("text_" + language)) {
|
||||
text = news.getJSONObject(i).getString("text_" + language);
|
||||
} else {
|
||||
text = news.getJSONObject(i).getString("text");
|
||||
}
|
||||
|
||||
String categoryString = news.getJSONObject(i).getString("category");
|
||||
int category;
|
||||
if (categoryString.equals("CATEGORY_TRICKS"))
|
||||
@@ -65,10 +74,6 @@ public class NewsManager {
|
||||
category = News.CATEGORY_UPDATE;
|
||||
String dateString = news.getJSONObject(i).getString("date");
|
||||
long date = UtilsDate.stringToMillis(dateString, "dd.MM.yyyy");
|
||||
String text = news.getJSONObject(i).getString("title_" + language);
|
||||
//noinspection ConstantConditions
|
||||
if (text == null)
|
||||
text = news.getJSONObject(i).getString("text");
|
||||
News event = new News(title, category, date, text);
|
||||
dates.add(event);
|
||||
} catch (JSONException e) {
|
||||
|
||||
Reference in New Issue
Block a user