From e9256d3b0b69193d21492fee7a5e2730c1c8bc9f Mon Sep 17 00:00:00 2001 From: Nimetu Date: Sat, 18 Oct 2014 00:15:51 +0300 Subject: [PATCH] Fix crash when using textarea without form --- code/nel/src/gui/group_html.cpp | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/code/nel/src/gui/group_html.cpp b/code/nel/src/gui/group_html.cpp index 1a2ae5b4b..d42e1fed3 100644 --- a/code/nel/src/gui/group_html.cpp +++ b/code/nel/src/gui/group_html.cpp @@ -1681,21 +1681,19 @@ namespace NLGUI break; case HTML_TEXTAREA: { - // Add the editbox - // nlinfo("textarea temp '%s'", _TextAreaTemplate.c_str()); - // nlinfo("textarea name '%s'", _TextAreaName.c_str()); - // nlinfo("textarea %d %d", _TextAreaRow, _TextAreaCols); - // nlinfo("textarea content '%s'", _TextAreaContent.toUtf8().c_str()); - CInterfaceGroup *textArea = addTextArea (_TextAreaTemplate, _TextAreaName.c_str (), _TextAreaRow, _TextAreaCols, true, _TextAreaContent, _TextAreaMaxLength); - if (textArea) - { - // Add the text area to the form - CGroupHTML::CForm::CEntry entry; - entry.Name = _TextAreaName; - entry.TextArea = textArea; - _Forms.back().Entries.push_back (entry); - } _TextArea = false; + if (!(_Forms.empty())) + { + CInterfaceGroup *textArea = addTextArea (_TextAreaTemplate, _TextAreaName.c_str (), _TextAreaRow, _TextAreaCols, true, _TextAreaContent, _TextAreaMaxLength); + if (textArea) + { + // Add the text area to the form + CGroupHTML::CForm::CEntry entry; + entry.Name = _TextAreaName; + entry.TextArea = textArea; + _Forms.back().Entries.push_back (entry); + } + } } break; case HTML_TITLE: