mirror of
https://github.com/sp-tarkov/modules.git
synced 2025-02-13 09:50:43 -05:00
Skip iterating over items if is null or empty
This commit is contained in:
parent
bbc8e4d1c8
commit
78a22ead66
@ -10,7 +10,7 @@ namespace Aki.SinglePlayer.Utils.Insurance
|
|||||||
public class InsuredItemManager
|
public class InsuredItemManager
|
||||||
{
|
{
|
||||||
private static InsuredItemManager _instance;
|
private static InsuredItemManager _instance;
|
||||||
private List<Item> items;
|
private List<Item> _items;
|
||||||
|
|
||||||
public static InsuredItemManager Instance
|
public static InsuredItemManager Instance
|
||||||
{
|
{
|
||||||
@ -27,13 +27,18 @@ namespace Aki.SinglePlayer.Utils.Insurance
|
|||||||
|
|
||||||
public void Init()
|
public void Init()
|
||||||
{
|
{
|
||||||
items = Singleton<GameWorld>.Instance?.MainPlayer?.Profile?.Inventory?.AllRealPlayerItems.ToList();
|
_items = Singleton<GameWorld>.Instance?.MainPlayer?.Profile?.Inventory?.AllRealPlayerItems.ToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<AkiInsuredItemClass> GetTrackedItems()
|
public List<AkiInsuredItemClass> GetTrackedItems()
|
||||||
{
|
{
|
||||||
var itemsToSend = new List<AkiInsuredItemClass>();
|
var itemsToSend = new List<AkiInsuredItemClass>();
|
||||||
foreach (var item in items)
|
if (_items == null || _items.Count() == 0)
|
||||||
|
{
|
||||||
|
return itemsToSend;
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (var item in _items)
|
||||||
{
|
{
|
||||||
var aki = new AkiInsuredItemClass
|
var aki = new AkiInsuredItemClass
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user