From b92418a82c69b5f18570673bb3772deb07ce2f0d Mon Sep 17 00:00:00 2001 From: Stefano Ceccherini Date: Wed, 5 Jul 2006 19:50:08 +0000 Subject: [PATCH] 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 --- src/kits/interface/BTextView/TextView.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/kits/interface/BTextView/TextView.cpp b/src/kits/interface/BTextView/TextView.cpp index dd6ba8c049..5a4291b593 100644 --- a/src/kits/interface/BTextView/TextView.cpp +++ b/src/kits/interface/BTextView/TextView.cpp @@ -1098,7 +1098,8 @@ BTextView::SetText(BFile *inFile, int32 inOffset, int32 inLength, void 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, const text_run_array *inRuns) { - Insert(fSelStart, inText, inLength, inRuns); + if (inText != NULL) + Insert(fSelStart, inText, inLength, inRuns); }