File tree Expand file tree Collapse file tree
lib/src/main/java/xyz/gianlu/librespot/common
player/src/main/java/xyz/gianlu/librespot/player/state Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -181,12 +181,14 @@ public static Player.PlayOrigin convertPlayOrigin(@Nullable PlayOrigin po) {
181181
182182
183183 @ NotNull
184- public static ContextPlayerOptions jsonToPlayerOptions (@ NotNull JsonObject obj , @ Nullable ContextPlayerOptions old ) {
184+ public static ContextPlayerOptions jsonToPlayerOptions (@ Nullable JsonObject obj , @ Nullable ContextPlayerOptions old ) {
185185 ContextPlayerOptions .Builder builder = old == null ? ContextPlayerOptions .newBuilder () : old .toBuilder ();
186186
187- Optional .ofNullable (obj .get ("repeating_context" )).ifPresent (elm -> builder .setRepeatingContext (elm .getAsBoolean ()));
188- Optional .ofNullable (obj .get ("repeating_track" )).ifPresent (elm -> builder .setRepeatingTrack (elm .getAsBoolean ()));
189- Optional .ofNullable (obj .get ("shuffling_context" )).ifPresent (elm -> builder .setShufflingContext (elm .getAsBoolean ()));
187+ if (obj != null ) {
188+ Optional .ofNullable (obj .get ("repeating_context" )).ifPresent (elm -> builder .setRepeatingContext (elm .getAsBoolean ()));
189+ Optional .ofNullable (obj .get ("repeating_track" )).ifPresent (elm -> builder .setRepeatingTrack (elm .getAsBoolean ()));
190+ Optional .ofNullable (obj .get ("shuffling_context" )).ifPresent (elm -> builder .setShufflingContext (elm .getAsBoolean ()));
191+ }
190192
191193 return builder .build ();
192194 }
Original file line number Diff line number Diff line change @@ -323,7 +323,7 @@ public static JsonObject getContext(@NotNull JsonObject obj) {
323323 return obj .getAsJsonObject ("context" );
324324 }
325325
326- @ NotNull
326+ @ Nullable
327327 public static JsonObject getPlayerOptionsOverride (@ NotNull JsonObject obj ) {
328328 return obj .getAsJsonObject ("options" ).getAsJsonObject ("player_options_override" );
329329 }
You can’t perform that action at this time.
0 commit comments