Skip to content

querying for a name containing "w" gives fatal error #20

@jmshgs

Description

@jmshgs

this is my code:

let apicalypse = APICalypse()
    .fields(fields: "id,name,category") // Specify the fields you want to retrieve
    .where(query: "name = \"w\"") // Use the "where" clause to search by name
    .limit(value: 50)

// Make the API request to search for the game by name.
wrapper.games(apiCalypse: apicalypse, result: { games in
    // Handle the retrieved games here
    for game in games {
        if game.name.lowercased() == name.lowercased() {
            print(game)
        }
    }
}) { error in
    // Handle any errors that occur during the request
    print("Error searching for the game: \(error)")
}

whenever a lowercase 'w' is queried the following error is printed:

Error searching for the game: RequestException(statusCode: 400, url: "https://api.igdb.com/v4/games.pb", msg: "[\n  {\n    \"title\": \"Syntax Error\",\n    \"status\": 400\n  }\n]")
IGDB_SWIFT_API/ProtoRequest.swift:107: Fatal error: 'try!' expression unexpectedly raised an error: SwiftProtobuf.BinaryDecodingError.truncated
image

seems to me like the force unwrap being used in that function is the issue

similar to #10

maybe fixed in moritzscholz's fork where he fixes the force unwrap, still crashes for me though

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