Skip to content

Commit

Permalink
Fixed a crash that would happen if no planettype was selected in the …
Browse files Browse the repository at this point in the history
…planet spawn menu
  • Loading branch information
thorwin99 committed Oct 22, 2021
1 parent e194660 commit 7506c8b
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions SEWorldGenPlugin/GUI/AdminMenu/SubMenus/MyPlanetSpawnMenu.cs
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,11 @@ public override void RefreshInternals(MyGuiControlParentTableLayout parent, floa
m_planetDefList.VisibleRowsCount = 8;
m_planetDefList.MultiSelect = false;
m_planetDefList.Size = new Vector2(maxWidth, m_planetDefList.Size.Y);
m_planetDefList.ItemsSelected += delegate (MyGuiControlListbox box)
{
m_spawnAtCoordButton.Enabled = m_planetDefList.GetLastSelected() != null;
m_spawnPlanetButton.Enabled = m_spawnAtCoordButton.Enabled;
};

parent.AddTableRow(new MyGuiControlLabel(text: "Type"));
parent.AddTableRow(m_planetDefList);
Expand Down Expand Up @@ -112,6 +117,9 @@ public override void RefreshInternals(MyGuiControlParentTableLayout parent, floa
parent.AddTableRow(m_spawnAtCoordButton);

LoadPlanetDefs();

m_spawnAtCoordButton.Enabled = m_planetDefList.GetLastSelected() != null;
m_spawnPlanetButton.Enabled = m_spawnAtCoordButton.Enabled;
}

/// <summary>
Expand Down

0 comments on commit 7506c8b

Please sign in to comment.