summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CHANGES1
-rw-r--r--src/Fl_Browser.cxx6
2 files changed, 5 insertions, 2 deletions
diff --git a/CHANGES b/CHANGES
index 5efc7dbbf..b7e8fe83b 100644
--- a/CHANGES
+++ b/CHANGES
@@ -59,6 +59,7 @@ CHANGES IN FLTK 1.3.4 RELEASED: ??? ?? ????
Bug fixes
+ - Fix Fl_Browser if text argument to some methods is NULL (STR #3269).
- Fixed missing image release in fluid (STR #2840).
- Fixed out-of-bounds memory access in fluid (STR #3263).
- fluid doesn't output trailing white space in .fl files after
diff --git a/src/Fl_Browser.cxx b/src/Fl_Browser.cxx
index b9c140780..c81c88edc 100644
--- a/src/Fl_Browser.cxx
+++ b/src/Fl_Browser.cxx
@@ -80,7 +80,7 @@ void* Fl_Browser::item_next(void* item) const {return ((FL_BLINE*)item)->next;}
/**
Returns the previous item before \p item.
\param[in] item The 'current' item
- \returns The previous item before \p item, or NULL if there none before this one.
+ \returns The previous item before \p item, or NULL if there are none before this one.
\see item_first(), item_last(), item_next(), item_prev()
*/
void* Fl_Browser::item_prev(void* item) const {return ((FL_BLINE*)item)->prev;}
@@ -284,6 +284,7 @@ void Fl_Browser::insert(int line, FL_BLINE* item) {
\param[in] d Optional pointer to user data to be associated with the new line.
*/
void Fl_Browser::insert(int line, const char* newtext, void* d) {
+ if (!newtext) newtext = ""; // STR #3269
int l = (int) strlen(newtext);
FL_BLINE* t = (FL_BLINE*)malloc(sizeof(FL_BLINE)+l);
t->length = (short)l;
@@ -319,6 +320,7 @@ void Fl_Browser::move(int to, int from) {
void Fl_Browser::text(int line, const char* newtext) {
if (line < 1 || line > lines) return;
FL_BLINE* t = find_line(line);
+ if (!newtext) newtext = ""; // STR #3269
int l = (int) strlen(newtext);
if (l > t->length) {
FL_BLINE* n = (FL_BLINE*)malloc(sizeof(FL_BLINE)+l);
@@ -789,7 +791,7 @@ int Fl_Browser::visible(int line) const {
}
/**
- Returns the line number of the currently selected line, or 0 if none.
+ Returns the line number of the currently selected line, or 0 if none selected.
\returns The line number of current selection, or 0 if none selected.
\see select(), selected(), value(), item_select(), item_selected()
*/