From 4966886b70e6928842f59cc5c787806b85959ca0 Mon Sep 17 00:00:00 2001 From: Ellpeck Date: Sat, 30 Oct 2021 15:35:46 +0200 Subject: [PATCH] fixed a ui demo crash when leaving while the wobble button is wobbling --- Demos/UiDemo.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Demos/UiDemo.cs b/Demos/UiDemo.cs index 45feeb0..31908ff 100644 --- a/Demos/UiDemo.cs +++ b/Demos/UiDemo.cs @@ -241,7 +241,7 @@ namespace Demos { // Note that this particular example makes use of the Coroutine package, which is not required but makes demonstration easier private static IEnumerator WobbleButton(Element button) { var counter = 0F; - while (counter < 4 * Math.PI) { + while (counter < 4 * Math.PI && button.Root != null) { // Every element allows the implementation of any sort of custom rendering for itself and all of its child components // This includes simply changing the transform matrix like here, but also applying custom effects and doing // anything else that can be done in the SpriteBatch's Begin call.