mirror of
https://github.com/fltk/fltk.git
synced 2026-06-05 16:12:13 +08:00
Add NULL checks for browser strings.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@3421 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
+5
-5
@@ -1,5 +1,5 @@
|
|||||||
//
|
//
|
||||||
// "$Id: Fl_Browser.cxx,v 1.9.2.12.2.10 2004/05/15 22:58:18 easysw Exp $"
|
// "$Id: Fl_Browser.cxx,v 1.9.2.12.2.11 2004/05/16 02:18:13 easysw Exp $"
|
||||||
//
|
//
|
||||||
// Browser widget for the Fast Light Tool Kit (FLTK).
|
// Browser widget for the Fast Light Tool Kit (FLTK).
|
||||||
//
|
//
|
||||||
@@ -218,7 +218,7 @@ int Fl_Browser::item_height(void* lv) const {
|
|||||||
else {
|
else {
|
||||||
const int* i = column_widths();
|
const int* i = column_widths();
|
||||||
// do each column separately as they may all set different fonts:
|
// do each column separately as they may all set different fonts:
|
||||||
for (char* str = l->txt; *str; str++) {
|
for (char* str = l->txt; str && *str; str++) {
|
||||||
Fl_Font font = textfont(); // default font
|
Fl_Font font = textfont(); // default font
|
||||||
int tsize = textsize(); // default size
|
int tsize = textsize(); // default size
|
||||||
while (*str==format_char()) {
|
while (*str==format_char()) {
|
||||||
@@ -240,13 +240,13 @@ int Fl_Browser::item_height(void* lv) const {
|
|||||||
}
|
}
|
||||||
END_FORMAT:
|
END_FORMAT:
|
||||||
char* ptr = str;
|
char* ptr = str;
|
||||||
if (*i++) str = strchr(str, column_char());
|
if (ptr && *i++) str = strchr(str, column_char());
|
||||||
else str = NULL;
|
else str = NULL;
|
||||||
if((!str && *ptr) || (str && ptr < str)) {
|
if((!str && *ptr) || (str && ptr < str)) {
|
||||||
fl_font(font, tsize); int hh = fl_height();
|
fl_font(font, tsize); int hh = fl_height();
|
||||||
if (hh > hmax) hmax = hh;
|
if (hh > hmax) hmax = hh;
|
||||||
}
|
}
|
||||||
if (!*str) break;
|
if (!str || !*str) break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -498,5 +498,5 @@ int Fl_Browser::value() const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// End of "$Id: Fl_Browser.cxx,v 1.9.2.12.2.10 2004/05/15 22:58:18 easysw Exp $".
|
// End of "$Id: Fl_Browser.cxx,v 1.9.2.12.2.11 2004/05/16 02:18:13 easysw Exp $".
|
||||||
//
|
//
|
||||||
|
|||||||
Reference in New Issue
Block a user