Fix NullPointerException in MediaBrowserImplLegacy

PiperOrigin-RevId: 748312932
This commit is contained in:
bachinger 2025-04-16 09:04:18 -07:00 committed by Copybara-Service
parent 5d540acbeb
commit a64d51c909
2 changed files with 5 additions and 1 deletions

View File

@ -50,6 +50,9 @@
* Fix a bug where a load error in one ad may accidentally invalidate * Fix a bug where a load error in one ad may accidentally invalidate
another ad group. another ad group.
* Session: * Session:
* Fix a bug where passing null into `getLibraryRoot` of a `MediaBrowser`
connected to a legacy `MediaBrowserServiceCompat` produced a
`NullPointerException`.
* UI: * UI:
* Downloads: * Downloads:
* Add partial download support for progressive streams. Apps can prepare a * Add partial download support for progressive streams. Apps can prepare a

View File

@ -132,7 +132,8 @@ import org.checkerframework.checker.initialization.qual.UnderInitialization;
// Already connected with the given extras. // Already connected with the given extras.
result.set(LibraryResult.ofItem(createRootMediaItem(browserCompat), null)); result.set(LibraryResult.ofItem(createRootMediaItem(browserCompat), null));
} else { } else {
Bundle rootHints = LegacyConversions.convertToRootHints(params); Bundle rootHints =
params == null ? new Bundle() : LegacyConversions.convertToRootHints(params);
rootHints.putInt( rootHints.putInt(
androidx.media3.session.legacy.MediaConstants androidx.media3.session.legacy.MediaConstants
.BROWSER_ROOT_HINTS_KEY_CUSTOM_BROWSER_ACTION_LIMIT, .BROWSER_ROOT_HINTS_KEY_CUSTOM_BROWSER_ACTION_LIMIT,