From 0d41808d900d2b58d2be23782e8dcdbcf57b39a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89milie=20Feral?= Date: Thu, 9 Feb 2017 09:24:22 +0100 Subject: [PATCH] [escher] Fix bug in textfield Change-Id: I86df7fb5c95c0a030018b332ee5dfa63c66b4127 --- escher/src/text_field.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/escher/src/text_field.cpp b/escher/src/text_field.cpp index 9f898efac..949881df3 100644 --- a/escher/src/text_field.cpp +++ b/escher/src/text_field.cpp @@ -163,7 +163,9 @@ void TextField::insertTextAtLocation(const char * text, int location) { m_draftTextBuffer[k+textSize] = m_draftTextBuffer[k]; } strlcpy(&m_draftTextBuffer[location], text, textSize); - m_draftTextBuffer[location+textSize-1] = text[textSize-1]; + if (location+textSize > 0) { + m_draftTextBuffer[location+textSize-1] = text[textSize-1]; + } m_currentTextLength += textSize; reload(); }