mirror of
https://github.com/ppy/osu
synced 2024-12-27 01:12:45 +00:00
Use better safety in rectangular grid
- Checking `DrawSize != Vector2.Zero` is too specific. It could also crash on zero-height-but-non-zero-width, or zero-width-but-non-zero-height. - Take the `gridCache.Validate()` call out of the zero checks, because even if the width or height are zero, not generating anything is valid and there is no reason to validate every frame until `gridCache` gets invalidated again.
This commit is contained in:
parent
0c10d875ce
commit
c6f0cf50ca
@ -55,13 +55,12 @@ namespace osu.Game.Screens.Edit.Compose.Components
|
||||
{
|
||||
ClearInternal();
|
||||
|
||||
if (DrawSize != Vector2.Zero)
|
||||
{
|
||||
if (DrawWidth > 0 && DrawHeight > 0)
|
||||
createContent();
|
||||
|
||||
gridCache.Validate();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void createContent()
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user