From 7b27b93875bb230579bcdd40a7c93a85f0761dba Mon Sep 17 00:00:00 2001 From: AJR Date: Sun, 13 Jun 2021 12:32:51 -0400 Subject: [PATCH] rendlay.cpp: Fix assertion failure with -D_GLIBCXX_ASSERTIONS --- src/emu/rendlay.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/emu/rendlay.cpp b/src/emu/rendlay.cpp index 789c7c15a7c..00322df4203 100644 --- a/src/emu/rendlay.cpp +++ b/src/emu/rendlay.cpp @@ -530,6 +530,7 @@ private: // variable found if (start == 0) m_buffer.seekp(0); + assert(start < str.length()); m_buffer.write(&str[start], pos - start); m_buffer.write(text.first.data(), text.first.length()); start = term - str.begin() + 1; @@ -550,7 +551,8 @@ private: } else { - m_buffer.write(&str[start], str.length() - start); + if (start < str.length()) + m_buffer.write(&str[start], str.length() - start); return util::buf_to_string_view(m_buffer); } }