diff --git a/OpenRA.Mods.Common/Widgets/Logic/AssetBrowserLogic.cs b/OpenRA.Mods.Common/Widgets/Logic/AssetBrowserLogic.cs index d7095a914c..5b4df869b5 100644 --- a/OpenRA.Mods.Common/Widgets/Logic/AssetBrowserLogic.cs +++ b/OpenRA.Mods.Common/Widgets/Logic/AssetBrowserLogic.cs @@ -124,7 +124,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic frameContainer.IsVisible = () => (currentSprites != null && currentSprites.Length > 1) || (isVideoLoaded && player != null && player.Video != null && player.Video.Frames > 1); - frameSlider = panel.Get("FRAME_SLIDER"); + frameSlider = panel.GetOrNull("FRAME_SLIDER"); if (frameSlider != null) { frameSlider.OnChange += x => @@ -183,7 +183,9 @@ namespace OpenRA.Mods.Common.Widgets.Logic player.Stop(); else { - frameSlider.Value = 0; + if (frameSlider != null) + frameSlider.Value = 0; + currentFrame = 0; animateFrames = false; } @@ -336,15 +338,23 @@ namespace OpenRA.Mods.Common.Widgets.Logic player.Load(prefix + filename); player.DrawOverlay = false; isVideoLoaded = true; - frameSlider.MaximumValue = (float)player.Video.Frames - 1; - frameSlider.Ticks = 0; + + if (frameSlider != null) + { + frameSlider.MaximumValue = (float)player.Video.Frames - 1; + frameSlider.Ticks = 0; + } + return true; } currentSprites = world.Map.Rules.Sequences.SpriteCache[prefix + filename]; currentFrame = 0; - frameSlider.MaximumValue = (float)currentSprites.Length - 1; - frameSlider.Ticks = currentSprites.Length; + if (frameSlider != null) + { + frameSlider.MaximumValue = (float)currentSprites.Length - 1; + frameSlider.Ticks = currentSprites.Length; + } } catch (Exception ex) { diff --git a/OpenRA.Mods.Common/Widgets/Logic/Ingame/DebugMenuLogic.cs b/OpenRA.Mods.Common/Widgets/Logic/Ingame/DebugMenuLogic.cs index fb6c1b1c31..2b5433d9e3 100644 --- a/OpenRA.Mods.Common/Widgets/Logic/Ingame/DebugMenuLogic.cs +++ b/OpenRA.Mods.Common/Widgets/Logic/Ingame/DebugMenuLogic.cs @@ -85,7 +85,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic showScreenMapCheckbox.OnClick = () => debugVis.ScreenMap ^= true; } - var terrainGeometryTrait = world.WorldActor.Trait(); + var terrainGeometryTrait = world.WorldActor.TraitOrDefault(); var showTerrainGeometryCheckbox = widget.GetOrNull("SHOW_TERRAIN_OVERLAY"); if (showTerrainGeometryCheckbox != null && terrainGeometryTrait != null) {