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
+4 -2
View File
@@ -1098,7 +1098,8 @@ 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)
{ {
Insert(fSelStart, inText, strlen(inText), inRuns); if (inText != NULL)
Insert(fSelStart, inText, strlen(inText), inRuns);
} }
@@ -1106,7 +1107,8 @@ 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)
{ {
Insert(fSelStart, inText, inLength, inRuns); if (inText != NULL)
Insert(fSelStart, inText, inLength, inRuns);
} }