From 724e4f423c0573c40b27e5949ab36713f7569ddd Mon Sep 17 00:00:00 2001 From: Robert MacGregor Date: Tue, 2 Nov 2021 08:16:54 -0400 Subject: [PATCH] * BugFix: Correct an ASAN reported memory access error when calling updateHeight on GuiGameListMenuCtrl when an invalid profile is initially set. --- Engine/source/gui/controls/guiGameListMenuCtrl.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/Engine/source/gui/controls/guiGameListMenuCtrl.cpp b/Engine/source/gui/controls/guiGameListMenuCtrl.cpp index 33efb32d8..7a9951087 100644 --- a/Engine/source/gui/controls/guiGameListMenuCtrl.cpp +++ b/Engine/source/gui/controls/guiGameListMenuCtrl.cpp @@ -543,7 +543,8 @@ Point2I GuiGameListMenuCtrl::getMinExtent() const { Point2I parentMin = Parent::getMinExtent(); - GuiGameListMenuProfile * profile = (GuiGameListMenuProfile *) mProfile; + GuiGameListMenuProfile * profile = dynamic_cast(mProfile); + AssertFatal(profile, "Invalid profile for GuiGameListMenuCtrl!"); S32 minHeight = 0; S32 rowHeight = profile->getRowHeight(); @@ -632,10 +633,13 @@ void GuiGameListMenuCtrl::enforceConstraints() void GuiGameListMenuCtrl::updateHeight() { - S32 minHeight = getMinExtent().y; - if (getHeight() < minHeight) + if (hasValidProfile()) { - setHeight(minHeight); + S32 minHeight = getMinExtent().y; + if (getHeight() < minHeight) + { + setHeight(minHeight); + } } }