try fix crashing and increase stack limit to 50

This commit is contained in:
SilicaAndPina 2021-02-05 15:37:32 +13:00
parent 6ce2c33a42
commit 76f3d7d731
2 changed files with 15 additions and 3 deletions

View file

@ -27,6 +27,9 @@ namespace HISP.Game.Items
int count = 0; int count = 0;
for(int i = 0; i < droppedItems.Length; i++) for(int i = 0; i < droppedItems.Length; i++)
{ {
if (droppedItems[i] == null) // Item removed in another thread.
continue;
if(droppedItems[i].Instance.ItemId == item.Id) if(droppedItems[i].Instance.ItemId == item.Id)
{ {
count++; count++;
@ -42,7 +45,10 @@ namespace HISP.Game.Items
List<DroppedItem> items = new List<DroppedItem>(); List<DroppedItem> items = new List<DroppedItem>();
for(int i = 0; i < droppedItems.Length; i++) for(int i = 0; i < droppedItems.Length; i++)
{ {
if(droppedItems[i].X == x && droppedItems[i].Y == y) if (droppedItems[i] == null) // Item removed in another thread.
continue;
if (droppedItems[i].X == x && droppedItems[i].Y == y)
{ {
items.Add(droppedItems[i]); items.Add(droppedItems[i]);
} }
@ -88,7 +94,10 @@ namespace HISP.Game.Items
for(int i = 0; i < droppedItems.Length; i++) for(int i = 0; i < droppedItems.Length; i++)
{ {
if(droppedItems[i].Instance.RandomId == randomId) if (droppedItems[i] == null) // Item removed in another thread.
continue;
if (droppedItems[i].Instance.RandomId == randomId)
{ {
return droppedItems[i]; return droppedItems[i];
} }
@ -103,6 +112,9 @@ namespace HISP.Game.Items
for(int i = 0; i < droppedItemsList.Count; i++) for(int i = 0; i < droppedItemsList.Count; i++)
{ {
if (droppedItemsList[i] == null) // Item removed in another thread.
continue;
droppedItemsList[i].DespawnTimer--; droppedItemsList[i].DespawnTimer--;
if(droppedItemsList[i].DespawnTimer <= 0) if(droppedItemsList[i].DespawnTimer <= 0)
{ {

View file

@ -26,7 +26,7 @@ namespace HISP.Server
public static bool DoCorrections; public static bool DoCorrections;
public static bool DoNonViolations; public static bool DoNonViolations;
public const int MAX_STACK = 40; public const int MAX_STACK = 50;
private static string ConfigurationFileName = "server.properties"; private static string ConfigurationFileName = "server.properties";
public static void OpenConfig() public static void OpenConfig()