Check for NULL text, otherwise strlen() can crash. Might even fix bug 677

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@18044 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Stefano Ceccherini
2006-07-05 19:50:08 +00:00
parent 2384e64025
commit b92418a82c
@@ -1098,6 +1098,7 @@ BTextView::SetText(BFile *inFile, int32 inOffset, int32 inLength,
void void
BTextView::Insert(const char *inText, const text_run_array *inRuns) BTextView::Insert(const char *inText, const text_run_array *inRuns)
{ {
if (inText != NULL)
Insert(fSelStart, inText, strlen(inText), inRuns); Insert(fSelStart, inText, strlen(inText), inRuns);
} }
@@ -1106,6 +1107,7 @@ void
BTextView::Insert(const char *inText, int32 inLength, BTextView::Insert(const char *inText, int32 inLength,
const text_run_array *inRuns) const text_run_array *inRuns)
{ {
if (inText != NULL)
Insert(fSelStart, inText, inLength, inRuns); Insert(fSelStart, inText, inLength, inRuns);
} }