Skip to content

Commit

Permalink
Merge pull request #469 from sp00ktober/master
Browse files Browse the repository at this point in the history
Prevents index out of bounds in ILSShipManager
  • Loading branch information
sp00ktober authored Nov 10, 2021
2 parents 0e1f41f + 1afff51 commit b455254
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions NebulaWorld/Logistics/ILSShipManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -129,13 +129,13 @@ public void WorkShipBackToIdle(ILSShipData packet)
Array.Copy(stationComponent.workShipDatas, packet.origShipIndex + 1, stationComponent.workShipDatas, packet.origShipIndex, stationComponent.workShipDatas.Length - packet.origShipIndex - 1);
stationComponent.workShipCount--;
stationComponent.idleShipCount++;
if (stationComponent.idleShipCount < 0)
if (stationComponent.idleShipCount > packet.planetAStationMaxShipCount)
{
stationComponent.idleShipCount = 0;
stationComponent.idleShipCount = packet.planetAStationMaxShipCount;
}
if (stationComponent.workShipCount > packet.planetAStationMaxShipCount)
if (stationComponent.workShipCount < 0)
{
stationComponent.workShipCount = packet.planetAStationMaxShipCount;
stationComponent.workShipCount = 0;
}
stationComponent.WorkShipBackToIdle(packet.origShipIndex);
}
Expand Down

0 comments on commit b455254

Please sign in to comment.