diff --git a/RELEASENOTES.md b/RELEASENOTES.md index 1d5bdebba4..a1aea6e215 100644 --- a/RELEASENOTES.md +++ b/RELEASENOTES.md @@ -57,6 +57,8 @@ where `package` is different to the package of the current application. This wasn't previously documented to work, but is a more efficient way of accessing resources in another package than by name. + * Eagerly check `url` is non-null in the `DataSpec` constructors. This + parameter was already annotated to be non-null. * Effect: * Improved PQ to SDR tone-mapping by converting color spaces. * Support multiple speed changes within the same `EditedMediaItem` or diff --git a/libraries/datasource/src/main/java/androidx/media3/datasource/DataSpec.java b/libraries/datasource/src/main/java/androidx/media3/datasource/DataSpec.java index 2da5d6a095..dea5284fb3 100644 --- a/libraries/datasource/src/main/java/androidx/media3/datasource/DataSpec.java +++ b/libraries/datasource/src/main/java/androidx/media3/datasource/DataSpec.java @@ -15,6 +15,7 @@ */ package androidx.media3.datasource; +import static androidx.media3.common.util.Assertions.checkNotNull; import static java.lang.annotation.ElementType.TYPE_USE; import android.net.Uri; @@ -473,7 +474,7 @@ public final class DataSpec { Assertions.checkArgument(uriPositionOffset + position >= 0); Assertions.checkArgument(position >= 0); Assertions.checkArgument(length > 0 || length == C.LENGTH_UNSET); - this.uri = uri; + this.uri = checkNotNull(uri); this.uriPositionOffset = uriPositionOffset; this.httpMethod = httpMethod; this.httpBody = httpBody != null && httpBody.length != 0 ? httpBody : null;