Commit ea483f8c by tonihei Committed by Oliver Woodman

Fix some potential Uri nullness violations.

PiperOrigin-RevId: 223476569
parent 282cf303
......@@ -228,7 +228,8 @@ public final class DefaultDataSource implements DataSource {
// Choose the correct source for the scheme.
String scheme = dataSpec.uri.getScheme();
if (Util.isLocalFileUri(dataSpec.uri)) {
if (dataSpec.uri.getPath().startsWith("/android_asset/")) {
String uriPath = dataSpec.uri.getPath();
if (uriPath != null && uriPath.startsWith("/android_asset/")) {
dataSource = getAssetDataSource();
} else {
dataSource = getFileDataSource();
......
......@@ -204,7 +204,8 @@ public final class Util {
}
for (Uri uri : uris) {
if ("http".equals(uri.getScheme())
&& !NetworkSecurityPolicy.getInstance().isCleartextTrafficPermitted(uri.getHost())) {
&& !NetworkSecurityPolicy.getInstance()
.isCleartextTrafficPermitted(Assertions.checkNotNull(uri.getHost()))) {
// The security policy prevents cleartext traffic.
return false;
}
......
......@@ -23,7 +23,9 @@ public final class SsUtil {
/** Returns a fixed SmoothStreaming client manifest {@link Uri}. */
public static Uri fixManifestUri(Uri manifestUri) {
if (Util.toLowerInvariant(manifestUri.getLastPathSegment()).matches("manifest(\\(.+\\))?")) {
String lastPathSegment = manifestUri.getLastPathSegment();
if (lastPathSegment != null
&& Util.toLowerInvariant(lastPathSegment).matches("manifest(\\(.+\\))?")) {
return manifestUri;
}
return Uri.withAppendedPath(manifestUri, "Manifest");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment