diff --git a/OpenRA.Mods.Common/Widgets/Logic/MainMenuLogic.cs b/OpenRA.Mods.Common/Widgets/Logic/MainMenuLogic.cs index 2a23181582..ddc5fa7da5 100644 --- a/OpenRA.Mods.Common/Widgets/Logic/MainMenuLogic.cs +++ b/OpenRA.Mods.Common/Widgets/Logic/MainMenuLogic.cs @@ -80,16 +80,25 @@ namespace OpenRA.Mods.Common.Widgets.Logic mainMenu.Get("MULTIPLAYER_BUTTON").OnClick = OpenMultiplayerPanel; - mainMenu.Get("CONTENT_BUTTON").OnClick = () => + var contentButton = mainMenu.GetOrNull("CONTENT_BUTTON"); + if (contentButton != null) { - // Switching mods changes the world state (by disposing it), - // so we can't do this inside the input handler. - Game.RunAfterTick(() => + var hasContent = modData.Manifest.Contains(); + contentButton.Disabled = !hasContent; + contentButton.OnClick = () => { - var content = modData.Manifest.Get(); - Game.InitializeMod(content.ContentInstallerMod, new Arguments(new[] { "Content.Mod=" + modData.Manifest.Id })); - }); - }; + // Switching mods changes the world state (by disposing it), + // so we can't do this inside the input handler. + Game.RunAfterTick(() => + { + if (!hasContent) + return; + + var content = modData.Manifest.Get(); + Game.InitializeMod(content.ContentInstallerMod, new Arguments(new[] { "Content.Mod=" + modData.Manifest.Id })); + }); + }; + } mainMenu.Get("SETTINGS_BUTTON").OnClick = () => {