Fix NPE in TravelLocalDataHelper
This commit is contained in:
parent
faa88a3347
commit
1ec9acd00f
1 changed files with 4 additions and 3 deletions
|
@ -22,7 +22,7 @@ public class TravelLocalDataHelper {
|
||||||
private WikivoyageLocalDataDbHelper dbHelper;
|
private WikivoyageLocalDataDbHelper dbHelper;
|
||||||
|
|
||||||
private TLongObjectHashMap<WikivoyageSearchHistoryItem> historyMap;
|
private TLongObjectHashMap<WikivoyageSearchHistoryItem> historyMap;
|
||||||
private List<TravelArticle> savedArticles;
|
private List<TravelArticle> savedArticles = new ArrayList<>();
|
||||||
|
|
||||||
private Listener listener;
|
private Listener listener;
|
||||||
|
|
||||||
|
@ -36,7 +36,8 @@ public class TravelLocalDataHelper {
|
||||||
|
|
||||||
void refreshCachedData() {
|
void refreshCachedData() {
|
||||||
historyMap = dbHelper.getAllHistoryMap();
|
historyMap = dbHelper.getAllHistoryMap();
|
||||||
savedArticles = dbHelper.readSavedArticles();
|
savedArticles.clear();
|
||||||
|
savedArticles.addAll(dbHelper.readSavedArticles());
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<WikivoyageSearchHistoryItem> getAllHistory() {
|
public List<WikivoyageSearchHistoryItem> getAllHistory() {
|
||||||
|
@ -114,7 +115,7 @@ public class TravelLocalDataHelper {
|
||||||
savedArticles.add(article);
|
savedArticles.add(article);
|
||||||
dbHelper.addSavedArticle(article);
|
dbHelper.addSavedArticle(article);
|
||||||
notifySavedUpdated();
|
notifySavedUpdated();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void removeArticleFromSaved(@NonNull TravelArticle article) {
|
public void removeArticleFromSaved(@NonNull TravelArticle article) {
|
||||||
|
|
Loading…
Reference in a new issue