fixed crash

This commit is contained in:
nuclearfog 2023-04-15 02:17:45 +02:00
parent 88e685eae7
commit 504590cbd4
No known key found for this signature in database
GPG Key ID: 03488A185C476379
1 changed files with 5 additions and 5 deletions

View File

@ -48,10 +48,10 @@ public class PicassoBuilder implements SettingsChangeObserver {
* @return instance of Picasso with custom downloader
*/
public static Picasso get(Context context) {
if (notifySettingsChange || instance == null) {
instance = new PicassoBuilder(context);
}
synchronized (instance.imageCache) {
if (notifySettingsChange || instance == null) {
instance = new PicassoBuilder(context);
}
return new Picasso.Builder(context).downloader(instance.downloader).memoryCache(instance.imageCache).build();
}
}
@ -60,8 +60,8 @@ public class PicassoBuilder implements SettingsChangeObserver {
* clear image cache
*/
public static void clear() {
synchronized (instance.imageCache) {
if (instance != null) {
if (instance != null) {
synchronized (instance.imageCache) {
instance.imageCache.clear();
}
}