Skip to content

Commit

Permalink
Guard GroupCenter dbKey against null CBs, abort Spawn if empty key. C…
Browse files Browse the repository at this point in the history
…lose #14
  • Loading branch information
NathanKell committed Aug 27, 2023
1 parent 65a4f89 commit d01c4c0
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/Core/StaticGroup/GroupCenter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -81,11 +81,15 @@ internal bool isHidden
internal void Spawn()
{

if (StaticDatabase.HasGroupCenter(dbKey))
var key = dbKey;
if (string.IsNullOrEmpty(key))
return;

if (StaticDatabase.HasGroupCenter(key))
{
string oldName = Group;
int index = 0;
while (StaticDatabase.HasGroupCenter(dbKey))
while (StaticDatabase.HasGroupCenter(key))
{
Group = oldName + "_" + index.ToString();
index++;
Expand Down Expand Up @@ -472,6 +476,9 @@ internal string dbKey
{
get
{
var cb = CelestialBody;
if (cb == null)
return string.Empty;
return (CelestialBody.name + "_" + Group);
}
}
Expand Down

0 comments on commit d01c4c0

Please sign in to comment.