Fix potential crash in decref.

This commit is contained in:
Ottermandias 2023-07-23 16:13:34 +02:00
parent 4f2a14c9ee
commit 96e6ff0fbf
2 changed files with 14 additions and 6 deletions

View file

@ -48,9 +48,9 @@ internal sealed class EquipmentIdentificationList : KeyList<PseudoEquipItem>
private static IEnumerable<PseudoEquipItem> CreateEquipmentList(ItemData data) private static IEnumerable<PseudoEquipItem> CreateEquipmentList(ItemData data)
{ {
var items = gameData.GetExcelSheet<Item>(language)!; return data.Where(kvp => kvp.Key.IsEquipment() || kvp.Key.IsAccessory())
return items.Where(i => ((EquipSlot)i.EquipSlotCategory.Row).IsEquipmentPiece()) .SelectMany(kvp => kvp.Value)
.Select(i => (PseudoEquipItem)EquipItem.FromArmor(i)) .Select(i => (PseudoEquipItem)i)
.Concat(CustomList); .Concat(CustomList);
} }

View file

@ -212,8 +212,16 @@ public unsafe class ResourceLoader : IDisposable
if (handle->RefCount != 0) if (handle->RefCount != 0)
return; return;
try
{
Penumbra.Log.Error( Penumbra.Log.Error(
$"[ResourceLoader] Caught decrease of Reference Counter for {handle->FileName()} at 0x{(ulong)handle} below 0."); $"[ResourceLoader] Caught decrease of Reference Counter for {handle->FileName()} at 0x{(ulong)handle} below 0.");
}
catch
{
// ignored
}
returnValue = 1; returnValue = 1;
} }