Assert is due to wrong bounds passed to `std::clamp`. There seems no error in UI code, instead this occurs due to `layout.label()`. It returns an error due to missing case of `SCULPT_GREASE_PENCIL`. Due to the error, panel is not generated with properties and the `rect-> min/max` remained short enough to trigger assert Pull Request: https://projects.blender.org/blender/blender/pulls/123478