Skip to content

Bug: Error parsing API response when performing a search #1152

@Harthuz

Description

@Harthuz

Description:

When performing a search in the application, an error occurs while parsing the response from the Spotify API.

The error message is:

Api response: convert result failed, reason: Error("invalid type: null, expected struct SimplifiedPlaylist", line: 1, column: 273)

This suggests that the application attempted to parse a null value into a SimplifiedPlaylist structure, which is not allowed.

Steps to Reproduce:

  1. Open the application.
  2. Go to the search field.
  3. Type any search term and submit.
  4. The above error is triggered.

Screenshot of the error:

Image

Possible Cause:

The Spotify API may return null for certain fields when there are no results or missing data. The app currently expects every item to conform to the SimplifiedPlaylist structure, so it's crashing instead of handling null values gracefully.

Suggestion:

Add a check before parsing the API response to ensure that null values are handled appropriately or filtered out before deserialization.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions