mirror of
https://github.com/LBPUnion/ProjectLighthouse.git
synced 2025-07-24 06:01:30 +00:00
Handle null previewSlot in category system
This commit is contained in:
parent
6fcc51fca3
commit
86e07fdd9d
2 changed files with 10 additions and 8 deletions
|
@ -51,10 +51,11 @@ public abstract class CategoryWithUser : Category
|
|||
|
||||
public GameCategory Serialize(DatabaseContext database, UserEntity user)
|
||||
{
|
||||
List<SlotBase> slots = new()
|
||||
{
|
||||
SlotBase.CreateFromEntity(this.GetPreviewSlot(database, user), GameVersion.LittleBigPlanet3, user.UserId),
|
||||
};
|
||||
List<SlotBase> slots = new();
|
||||
SlotEntity? previewSlot = this.GetPreviewSlot(database, user);
|
||||
if (previewSlot != null)
|
||||
slots.Add(SlotBase.CreateFromEntity(previewSlot, GameVersion.LittleBigPlanet3, user.UserId));
|
||||
|
||||
int totalSlots = this.GetTotalSlots(database, user);
|
||||
return GameCategory.CreateFromEntity(this, new GenericSlotResponse(slots, totalSlots, 2));
|
||||
}
|
||||
|
|
|
@ -38,10 +38,11 @@ public abstract class Category
|
|||
|
||||
public GameCategory Serialize(DatabaseContext database)
|
||||
{
|
||||
List<SlotBase> slots = new()
|
||||
{
|
||||
SlotBase.CreateFromEntity(this.GetPreviewSlot(database), GameVersion.LittleBigPlanet3, -1),
|
||||
};
|
||||
List<SlotBase> slots = new();
|
||||
SlotEntity? previewSlot = this.GetPreviewSlot(database);
|
||||
if (previewSlot != null)
|
||||
slots.Add(SlotBase.CreateFromEntity(this.GetPreviewSlot(database), GameVersion.LittleBigPlanet3, -1));
|
||||
|
||||
int totalSlots = this.GetTotalSlots(database);
|
||||
return GameCategory.CreateFromEntity(this, new GenericSlotResponse(slots, totalSlots, 2));
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue