From 1ff0710cda34af900537d8d6b0e27712dbaef0d1 Mon Sep 17 00:00:00 2001 From: Baptiste Marie Date: Thu, 7 Nov 2024 12:56:58 +0100 Subject: [PATCH] `PlayerStyleComponent`: Fix null reference exception Caused by 9fbc727 --- GameServer/ECS-Components/PlayerStyleComponent.cs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/GameServer/ECS-Components/PlayerStyleComponent.cs b/GameServer/ECS-Components/PlayerStyleComponent.cs index cda51306f..3296ac6e4 100644 --- a/GameServer/ECS-Components/PlayerStyleComponent.cs +++ b/GameServer/ECS-Components/PlayerStyleComponent.cs @@ -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;