Skip to content

Commit

Permalink
STR2783: make potential null string substituted to an empty string, s…
Browse files Browse the repository at this point in the history
…till achieve internal cleanup in Fl_Text_Buffer::text(s)

git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@9366 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
  • Loading branch information
fab672000 committed Apr 21, 2012
1 parent eb9b58c commit 157a96a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion FL/Fl_Text_Buffer.H
Expand Up @@ -188,7 +188,7 @@ public:

/**
Replaces the entire contents of the text buffer.
\param text Text must be valid utf8.
\param text Text must be valid utf8. if null an empty string is substituted.
*/
void text(const char* text);

Expand Down
6 changes: 5 additions & 1 deletion src/Fl_Text_Buffer.cxx
Expand Up @@ -165,7 +165,11 @@ char *Fl_Text_Buffer::text() const {
void Fl_Text_Buffer::text(const char *t)
{
IS_UTF8_ALIGNED(t)


// if t is null then substitute it with an empty string
// then don't return so that internal cleanup can happen
if (!t) t="";

call_predelete_callbacks(0, length());

/* Save information for redisplay, and get rid of the old buffer */
Expand Down

0 comments on commit 157a96a

Please sign in to comment.