mirror of
https://github.com/samsonjs/media.git
synced 2026-04-04 11:05:47 +00:00
Fix some potential Uri nullness violations.
PiperOrigin-RevId: 223476569
This commit is contained in:
parent
282cf303a4
commit
ea483f8c8e
3 changed files with 7 additions and 3 deletions
|
|
@ -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");
|
||||
|
|
|
|||
Loading…
Reference in a new issue