Fix attempting to add selection boxes with no selection

E.g. because DrawableSpinner doesn't (currently) create an overlay, SelectionBox was being constructed with 0 hitobjects and then calculating a non-finite size for itself.
This commit is contained in:
smoogipoo 2018-03-19 18:00:11 +09:00
parent cbe2de33c5
commit 8d4c9eda48
1 changed files with 5 additions and 1 deletions

View File

@ -51,7 +51,11 @@ public void RemoveOverlay(DrawableHitObject hitObject)
private SelectionBox currentSelectionBox; private SelectionBox currentSelectionBox;
public void AddSelectionOverlay() => AddInternal(currentSelectionBox = composer.CreateSelectionOverlay(overlayContainer)); public void AddSelectionOverlay()
{
if (overlayContainer.Count > 0)
AddInternal(currentSelectionBox = composer.CreateSelectionOverlay(overlayContainer));
}
public void RemoveSelectionOverlay() public void RemoveSelectionOverlay()
{ {