Skip to content

Commit

Permalink
Android: Fix crash caused by Image.queryCache parsing null (#32101)
Browse files Browse the repository at this point in the history
Summary: Pull Request resolved: #32101

Reviewed By: cortinico

Differential Revision: D34687038

Pulled By: ShikaSD

fbshipit-source-id: 1b39a34a689a043425891416ff141ef622eacd24
  • Loading branch information
skychx authored and facebook-github-bot committed Mar 7, 2022
1 parent 7b05b09 commit ae3d4f7
Showing 1 changed file with 8 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
package com.facebook.react.modules.image;

import android.net.Uri;
import android.text.TextUtils;
import android.util.SparseArray;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
Expand Down Expand Up @@ -276,11 +277,13 @@ protected void doInBackgroundGuarded(Void... params) {
ImagePipeline imagePipeline = getImagePipeline();
for (int i = 0; i < uris.size(); i++) {
String uriString = uris.getString(i);
final Uri uri = Uri.parse(uriString);
if (imagePipeline.isInBitmapMemoryCache(uri)) {
result.putString(uriString, "memory");
} else if (imagePipeline.isInDiskCacheSync(uri)) {
result.putString(uriString, "disk");
if (!TextUtils.isEmpty(uriString)) {
final Uri uri = Uri.parse(uriString);
if (imagePipeline.isInBitmapMemoryCache(uri)) {
result.putString(uriString, "memory");
} else if (imagePipeline.isInDiskCacheSync(uri)) {
result.putString(uriString, "disk");
}
}
}
promise.resolve(result);
Expand Down

0 comments on commit ae3d4f7

Please sign in to comment.