exyte / Macaw

Powerful and easy-to-use vector graphics Swift library with SVG support
MIT License
6.01k stars 553 forks source link

Removing force unwrapping in SVGParser #733

Closed TomasLinhart closed 3 years ago

TomasLinhart commented 3 years ago

After the discussion in https://github.com/exyte/Macaw/issues/732 I went ahead and removed all force unwrapping from SVGParser. Some of it was safe, and it would never crash. Although, I still think it is a bad practice to use it, so I replaced it with other ways Swift has.

Nevertheless, many of these force unwrappings would actually result in a crash if somebody provided a non-ideal SVG.

I have also added some logging, but I guess it requires a bigger overhaul that is beyond my intention at this moment.

Let me know if you would prefer to do something differently.

ystrot commented 3 years ago

Thanks for these fixes!