Skip to content

Commit

Permalink
PlayerStyleComponent: Fix null reference exception
Browse files Browse the repository at this point in the history
Caused by 9fbc727
  • Loading branch information
bm01 committed Nov 7, 2024
1 parent e306741 commit 1ff0710
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion GameServer/ECS-Components/PlayerStyleComponent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,16 @@ public void OnPlayerSaveIntoDatabase()
{
DbCoreCharacter dbCharacter = _playerOwner.DBCharacter;

if (dbCharacter == null || AutomaticBackupStyle.ID == dbCharacter.AutomaticBackupStyleId)
if (dbCharacter == null)
return;

if (AutomaticBackupStyle == null)
{
dbCharacter.AutomaticBackupStyleId = 0;
return;
}

if (AutomaticBackupStyle.ID == dbCharacter.AutomaticBackupStyleId)
return;

dbCharacter.AutomaticBackupStyleId = (ushort) AutomaticBackupStyle.ID;
Expand Down

0 comments on commit 1ff0710

Please sign in to comment.