Small refactoring

This commit is contained in:
Dima-1 2021-01-28 17:21:32 +02:00
parent cbebccb123
commit 0f994e2da6
2 changed files with 3 additions and 3 deletions

View file

@ -143,8 +143,8 @@ public class TravelLocalDataHelper {
@Nullable @Nullable
private TravelArticle getArticle(String title, String lang) { private TravelArticle getArticle(String title, String lang) {
for (TravelArticle article : savedArticles) { for (TravelArticle article : savedArticles) {
if (article.title != null && article.title.equals(title) if (Algorithms.stringsEqual(article.title, title)
&& (article.lang != null && article.lang.equals(lang) || article.lang == null && lang == null)) { && Algorithms.stringsEqual(article.lang, lang)) {
return article; return article;
} }
} }

View file

@ -165,7 +165,7 @@ public class TravelObfHelper implements TravelHelper {
private TravelArticle cacheTravelArticles(File file, Amenity amenity, String lang, boolean readPoints, @Nullable GpxReadCallback callback) { private TravelArticle cacheTravelArticles(File file, Amenity amenity, String lang, boolean readPoints, @Nullable GpxReadCallback callback) {
TravelArticle article = null; TravelArticle article = null;
Map<String, TravelArticle> articles; Map<String, TravelArticle> articles;
if (Algorithms.objectEquals(amenity.getSubType(), ROUTE_TRACK)) { if (ROUTE_TRACK.equals(amenity.getSubType())) {
articles = readRoutePoint(file, amenity); articles = readRoutePoint(file, amenity);
} else { } else {
articles = readArticles(file, amenity); articles = readArticles(file, amenity);