Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
jxhug opened this issue Sep 3, 2023 · 0 comments
Open

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

jxhug opened this issue Sep 3, 2023 · 0 comments

Comments

@jxhug
Copy link

jxhug commented Sep 3, 2023

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant