From 4056f0191a9e8420cb33f68e713a38b211b37c94 Mon Sep 17 00:00:00 2001 From: Randy Heit Date: Sun, 12 Aug 2012 22:54:01 +0000 Subject: [PATCH] - Safely handle unknown HUD message layers. SVN r3823 (trunk) --- src/g_shared/shared_sbar.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/g_shared/shared_sbar.cpp b/src/g_shared/shared_sbar.cpp index 7f55fe0d0..d2636d337 100644 --- a/src/g_shared/shared_sbar.cpp +++ b/src/g_shared/shared_sbar.cpp @@ -391,6 +391,12 @@ void DBaseStatusBar::AttachMessage (DHUDMessage *msg, DWORD id, int layer) old->Destroy(); } + // Merge unknown layers into the default layer. + if ((size_t)layer >= countof(Messages)) + { + layer = HUDMSGLayer_Default; + } + prev = &Messages[layer]; // The ID serves as a priority, where lower numbers appear in front of