Skip to content

Commit

Permalink
- Bugfix: nullreference in InventoryLogging
Browse files Browse the repository at this point in the history
  • Loading branch information
dre77 committed Jul 24, 2011
1 parent 1a8a786 commit 81533cb
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions GameServer/gameutils/InventoryLogging.cs
Expand Up @@ -53,10 +53,10 @@ public static class InventoryLogging
};

public static Func<GameObject, string> GetGameObjectString = obj =>
"(" + obj.Name + ";" + obj.GetType() + ";" + obj.X + ";" + obj.Y + ";" + obj.Z + ";" + obj.CurrentRegionID + ")";
obj == null ? "(null)" : ("(" + obj.Name + ";" + obj.GetType() + ";" + obj.X + ";" + obj.Y + ";" + obj.Z + ";" + obj.CurrentRegionID + ")");

public static Func<ItemTemplate, int, string> GetItemString = (item, count) =>
"(" + count + ";" + item.Name + ";" + item.Id_nb + ")";
item == null ? "(null)" : ("(" + count + ";" + item.Name + ";" + item.Id_nb + ")");

public static Func<long, string> GetMoneyString = amount =>
"(MONEY;" + amount + ")";
Expand Down
4 changes: 2 additions & 2 deletions GameServerScripts/examples/CustomInventoryLoggingExample.cs
Expand Up @@ -19,8 +19,8 @@ public static void OnScriptLoaded(DOLEvent e, object sender, EventArgs args)
InventoryLogging.ActionXformat[eInventoryActionType.Craft] = "Craft: {0} gives {2} to {1}.";
InventoryLogging.ActionXformat[eInventoryActionType.Other] = "Other: {0} gives {2} to {1}.";

InventoryLogging.GetGameObjectString = obj => obj.Name;
InventoryLogging.GetItemString = (item, amount) => amount + " " + item.Name;
InventoryLogging.GetGameObjectString = obj => obj == null ? "(null)" : obj.Name;
InventoryLogging.GetItemString = (item, amount) => item == null ? "(null)" : (amount + " " + item.Name);
InventoryLogging.GetMoneyString = Money.GetString;
}
}
Expand Down

0 comments on commit 81533cb

Please sign in to comment.