From 65649e5a6264707f8079e5714931135431851cbf Mon Sep 17 00:00:00 2001 From: kamp Date: Mon, 24 May 2021 21:36:42 +0200 Subject: [PATCH] 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. --- osu.Game/Skinning/Editor/SkinSelectionHandler.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/osu.Game/Skinning/Editor/SkinSelectionHandler.cs b/osu.Game/Skinning/Editor/SkinSelectionHandler.cs index 99bd22c0bf..7ef07541b4 100644 --- a/osu.Game/Skinning/Editor/SkinSelectionHandler.cs +++ b/osu.Game/Skinning/Editor/SkinSelectionHandler.cs @@ -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;