public static @Nullable Uri parseUriOrNull(@Nullable String uriAsString) {
    return uriAsString != null ? Uri.parse(uriAsString) : null;
  }
A wrapper around {@link Uri#parse} that returns null if the input is null.

@param uriAsString the uri as a string
@return the parsed Uri or null if the input was null
fbcore/src/main/java/com/facebook/common/util/UriUtil.java