Prevent skin editor crash when scaling 0 area drawables

Some skinnable drawables can have 0 width or height in certain
cases, leading to division by 0 and a crash when the position is
updated.
This commit is contained in:
kamp 2021-05-24 21:36:42 +02:00
parent 6263ebf9da
commit 65649e5a62

View File

@ -59,6 +59,10 @@ namespace osu.Game.Skinning.Editor
// the selection quad is always upright, so use an AABB rect to make mutating the values easier.
var selectionRect = getSelectionQuad().AABBFloat;
// If the selection has no area we cannot scale it
if (selectionRect.Area == 0.0)
return false;
// copy to mutate, as we will need to compare to the original later on.
var adjustedRect = selectionRect;