Clear EhTagDatabase if it's not available

This commit is contained in:
seven332 committed 2019-01-27 14:17:55 +08:00
1 parent 81195726d5
commit 1edb8941ee
2 files changed
+8 -3

No files matched your search

@@ -145,8 +145,13 @@ public class EhTagDatabase {
private static Lock lock = new ReentrantLock();
@Nullable
public static EhTagDatabase getInstance() {
return instance;
public static EhTagDatabase getInstance(Context context) {
if (isPossible(context)) {
return instance;
} else {
instance = null;
return null;
}
}
@Nullable
@@ -869,7 +869,7 @@ public class GalleryDetailScene extends BaseScene implements View.OnClickListene
mNoTags.setVisibility(View.GONE);
}
EhTagDatabase ehTags = Settings.getShowTagTranslations() ? EhTagDatabase.getInstance() : null;
EhTagDatabase ehTags = Settings.getShowTagTranslations() ? EhTagDatabase.getInstance(context) : null;
int colorTag = AttrResources.getAttrColor(context, R.attr.tagBackgroundColor);
int colorName = AttrResources.getAttrColor(context, R.attr.tagGroupBackgroundColor);
for (GalleryTagGroup tg : tagGroups) {