diff --git a/src/g_shared/shared_sbar.cpp b/src/g_shared/shared_sbar.cpp index 7f55fe0d0f..d2636d337d 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