-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
fatal error: unexpectedly found nil while unwrapping an Optional value - inserting a row with .Ignore #383
Comments
The run function for Insert query should return an Optional from my point of view, then unwrapping is not needed and everyone is happy. |
Sorry, I looked through the list but must have missed #235. However I would oppose #295 - it misuses the concept of optionals. Instead of returning nil it returns -1 if lastInsertRowid does not exist. That is the returned value still has to be tested if it is a valid rowid, but less intuitive. |
I agree with your take on #295 (which is why it wasn't merged in). #237 fell off my radar. It wasn't explicitly rejected. GitHub unfortunately auto-closes PRs that are made against branches that get deleted. In this case, that PR was made against a short-lived branch. If you'd like to reopen such a pull and address my one comment, I'd be happy to merge it in! My take: the main
|
Yes, I agree, having both alternatives would be the best solution. Ok, I will try to come up with a solution. |
Any progress on solving this? This breaks the library if one wants to use |
should be fixed in 0.11.1 / #532 |
I insert a row into a db table like this:
if insert fails the app crashes since it tries to unwrap lastInsertRowid in the last line of the function below (in SQLite/Typed/Query.swift file class Connection lines 964-970), which is nil:
The lastInsertRowid is nil because insert has failed, and we reach the line where we try to unwrap lastInsertRowid because I have specified "or: .Ignore" when calling insert.
The text was updated successfully, but these errors were encountered: