RobustToolbox icon indicating copy to clipboard operation
RobustToolbox copied to clipboard

Fixed crash in ApplySizeConstraints

Open DoctorBeard opened this issue 3 years ago • 0 comments

Fixes #3029

This was caused by ApplySizeConstraints trying to use the current size of a control as its minimum size and then trying to clamp with the minimum value being larger than the maximum value.

MinSize is by default 0 so that value is just taken for the minimum constraints as is, regardless of what is set. After that it either takes MaxSize, if set, or SetSize, if set and actually larger or equal to MinSize as the maximum constraint. If neither of these is true the maximum constraint will end up being float.PositiveInfinity (the default of MaxSize).

ApplySizeConstraints isn't at all touched by the UI refactor last I checked so this PR should not conflict with that.

DoctorBeard avatar Aug 12 '22 15:08 DoctorBeard