gonzalezreal / swift-markdown-ui

Display and customize Markdown text in SwiftUI
MIT License
2.24k stars 266 forks source link

Crash on placeSubviews #289

Closed OmarJalil closed 5 months ago

OmarJalil commented 5 months ago

Thank you for contributing to MarkdownUI!

Before you submit an issue, please complete the report with all the relevant details for your bug and go through every item in the checklist.

Describe the bug FlowLayout > placeSubviews > line 24 is crashing

Thread 1: Fatal error: view origin is invalid: (nan, 8.0), UnitPoint(x: 0.0, y: 0.0), (0.0, 0.0)

Checklist

Steps to reproduce I use this Markdown in a list of text, the user sends. This text is crashing

Markdown(MarkdownContent("Words: words words word \n----\n---\n\\\n\\\n![](https://i1.wp.com/vaventura.com/wp-content/uploads/2018/04/archeVA.jpg?resize=1600%2C1774&ssl=1)"))

Expected behavior It shouldn't crash

Screenshots

Screenshot 2024-01-04 at 4 04 59 p m

Version information

Additional context

gonzalezreal commented 5 months ago

I could not reproduce the crash with the information you provided. MarkdownUI is rendering the content in the issue description just as expected.

Simulator Screen Shot - iPhone 14 Pro - 2024-01-06 at 11 05 56

Given that the crash cause is the invalid coordinates provided by the system in placeSubviews(in:proposal:subviews:cache:), the root cause must lay in the view hierarchy particular to your app.

I can only help if you provide a project reproducing the crash in isolation.