mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-02-09 09:12:06 +08:00
Fix a crash in Image when passed an invalid uri
Summary: public Fix https://github.com/facebook/react-native/issues/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
This commit is contained in:
committed by
facebook-github-bot-4
parent
cd2eed0d36
commit
798acac18e
@@ -352,11 +352,11 @@ public class ReactImageView extends GenericDraweeView {
|
||||
return resId > 0 ? context.getResources().getDrawable(resId) : null;
|
||||
}
|
||||
|
||||
private static @Nullable Uri getResourceDrawableUri(Context context, @Nullable String name) {
|
||||
private static Uri getResourceDrawableUri(Context context, @Nullable String name) {
|
||||
int resId = getResourceDrawableId(context, name);
|
||||
return resId > 0 ? new Uri.Builder()
|
||||
.scheme(UriUtil.LOCAL_RESOURCE_SCHEME)
|
||||
.path(String.valueOf(resId))
|
||||
.build() : null;
|
||||
.build() : Uri.EMPTY;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user