Character Select: Fix deleted memory access (#1237)

This commit is contained in:
David Markowitz 2023-10-24 02:26:39 -07:00 committed by GitHub
parent 025ff593ce
commit 3a37f9581c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -394,12 +394,13 @@ void Character::SetIsNewLogin() {
auto* currentChild = flags->FirstChildElement(); auto* currentChild = flags->FirstChildElement();
while (currentChild) { while (currentChild) {
auto* nextChild = currentChild->NextSiblingElement();
if (currentChild->Attribute("si")) { if (currentChild->Attribute("si")) {
flags->DeleteChild(currentChild); flags->DeleteChild(currentChild);
LOG("Removed isLoggedIn flag from character %i:%s, saving character to database", GetID(), GetName().c_str()); LOG("Removed isLoggedIn flag from character %i:%s, saving character to database", GetID(), GetName().c_str());
WriteToDatabase(); WriteToDatabase();
} }
currentChild = currentChild->NextSiblingElement(); currentChild = nextChild;
} }
} }