How to debug "type Nothing has no field color"

I hit the following bug: Switch on the tutorial project · Issue #8 · bradcarman/ModelingToolkitDesigner.jl · GitHub

But the author of the package cannot reproduce it. How can we find the reason for this bug?

Can anybody else reproduce it?

The stack trace of albheim in that issue say that the problem is on line 578 in src/ModelingToolkitDesigner.jl on version v1.0.0:

Looks like there is a isnothing check missing:

if !isnothing(selected_component)
    selected_component.color[] = :pink
    all_connectors =
        vcat([s.connectors for s in design.components]...)
    selected_connector = filtersingle(
        c -> is_tuple_approx(c.xy[], (x, y); atol = 1e-3),
    selected_connector.color[] = :pink # line nr. 578
1 Like

Thanks a lot! :grinning:

1 Like