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

Dangerous json parse operation #9

Open
ftp27 opened this issue Jun 28, 2023 · 1 comment
Open

Dangerous json parse operation #9

ftp27 opened this issue Jun 28, 2023 · 1 comment
Labels
question Further information is requested

Comments

@ftp27
Copy link

ftp27 commented Jun 28, 2023

data: try! JSONDecoder().decode(T.self, from: JSONSerialization.data(withJSONObject: map, options: []))

Not long ago, I updated libraries and encountered a crash during the parsing attempt. My old implementation was harmless because, in the event of a failed parse, I would simply return nil from the init method. This occurred when the server processed new data, and a failed parse was necessary for filtration purposes. Now, we need to utilize this parser, which even doesn't provide me with the opportunity to handle errors. Is it possible to remove the exclamation mark (!) from this line?

@joeyouss joeyouss added the bug Something isn't working label Jul 3, 2023
@joeyouss
Copy link

joeyouss commented Jul 3, 2023

Hi @ftp27 , I am not sure if we could do that but @wess what are your thoughts?

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

No branches or pull requests

3 participants