From 4e52dccdae35dd128adb6c37ec79a2ab00d66284 Mon Sep 17 00:00:00 2001 From: Misa Date: Wed, 24 Mar 2021 12:21:28 -0700 Subject: [PATCH] Initialize temporary edentity when loading levels It is possible for any of the QueryIntAttribute()s to fail, most commonly if the attributes don't exist. If that happens, then that part of the temporary edentity won't be initialized, and we'll end up having a partially-uninitialized edentity - then doing much of anything with it will result in undefined behavior. To fix this, just initialize the temporary edentity. --- desktop_version/src/editor.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/desktop_version/src/editor.cpp b/desktop_version/src/editor.cpp index 490517c2..552990e0 100644 --- a/desktop_version/src/editor.cpp +++ b/desktop_version/src/editor.cpp @@ -1783,7 +1783,7 @@ bool editorclass::load(std::string& _path) { for( tinyxml2::XMLElement* edEntityEl = pElem->FirstChildElement(); edEntityEl; edEntityEl=edEntityEl->NextSiblingElement()) { - edentities entity; + edentities entity = edentities(); const char* text = edEntityEl->GetText(); if (text != NULL)