migueldeicaza / SwiftGodot

New Godot bindings for Swift
https://migueldeicaza.github.io/SwiftGodotDocs/tutorials/swiftgodot-tutorials/
MIT License
1.06k stars 65 forks source link

Unsafe array indexing throughout project #411

Closed EstevanBR closed 1 month ago

EstevanBR commented 5 months ago

Feel free to close this issue if it's not valid.

I see things like

if let res = args[0].asObject() {

Which mixes safe code (if let) with unsafe array indexing (args[0])

Which would imo be safer as

if let firstArg = args.first, let res = firstArg.asObject() {
migueldeicaza commented 5 months ago

Where are you seeing this?

If this is for the generated setter arguments, we have bigger problems if the setter does not get at least one value ;-)

migueldeicaza commented 1 month ago

Closing, as it would not improve much per above