Skip to content

Commit 798acac

Browse files
Dave Millerfacebook-github-bot-4
authored andcommitted
Fix a crash in Image when passed an invalid uri
Summary: public Fix #5465 Instead of returning null when we fail to parse the Uri, just return an empty Uri which somewhat hides the problem but does prevent the crash Reviewed By: mkonicek Differential Revision: D2854902 fb-gh-sync-id: 71265d5e52302e174b898af5be25ac698abcf9ab
1 parent cd2eed0 commit 798acac

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

ReactAndroid/src/main/java/com/facebook/react/views/image/ReactImageView.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -352,11 +352,11 @@ private static int getResourceDrawableId(Context context, @Nullable String name)
352352
return resId > 0 ? context.getResources().getDrawable(resId) : null;
353353
}
354354

355-
private static @Nullable Uri getResourceDrawableUri(Context context, @Nullable String name) {
355+
private static Uri getResourceDrawableUri(Context context, @Nullable String name) {
356356
int resId = getResourceDrawableId(context, name);
357357
return resId > 0 ? new Uri.Builder()
358358
.scheme(UriUtil.LOCAL_RESOURCE_SCHEME)
359359
.path(String.valueOf(resId))
360-
.build() : null;
360+
.build() : Uri.EMPTY;
361361
}
362362
}

0 commit comments

Comments
 (0)