From 3a37f9581c21f0457e965fe72f4667985c89e6df Mon Sep 17 00:00:00 2001 From: David Markowitz <39972741+EmosewaMC@users.noreply.github.com> Date: Tue, 24 Oct 2023 02:26:39 -0700 Subject: [PATCH] Character Select: Fix deleted memory access (#1237) --- dGame/Character.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/dGame/Character.cpp b/dGame/Character.cpp index a153fe10..9c527ee5 100644 --- a/dGame/Character.cpp +++ b/dGame/Character.cpp @@ -394,12 +394,13 @@ void Character::SetIsNewLogin() { auto* currentChild = flags->FirstChildElement(); while (currentChild) { + auto* nextChild = currentChild->NextSiblingElement(); if (currentChild->Attribute("si")) { flags->DeleteChild(currentChild); LOG("Removed isLoggedIn flag from character %i:%s, saving character to database", GetID(), GetName().c_str()); WriteToDatabase(); } - currentChild = currentChild->NextSiblingElement(); + currentChild = nextChild; } }