summaryrefslogtreecommitdiff
path: root/src/Fl_File_Chooser2.cxx
diff options
context:
space:
mode:
authorGreg Ercolano <erco@seriss.com>2013-10-21 04:58:43 +0000
committerGreg Ercolano <erco@seriss.com>2013-10-21 04:58:43 +0000
commit45d7ae0a4c81491b7d9a554dbd637538f54190a5 (patch)
treeb3f56d6f273f3d0988e36b37ca4dabd159ad35db /src/Fl_File_Chooser2.cxx
parentda187139bcbefbba726d12a0ec540ed714566061 (diff)
Fixes STR#2991: prevents crash when file browser
encounters an image that can't be loaded. git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@10004 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src/Fl_File_Chooser2.cxx')
-rw-r--r--src/Fl_File_Chooser2.cxx9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/Fl_File_Chooser2.cxx b/src/Fl_File_Chooser2.cxx
index eddbbb5d2..bddae82f2 100644
--- a/src/Fl_File_Chooser2.cxx
+++ b/src/Fl_File_Chooser2.cxx
@@ -1423,6 +1423,15 @@ Fl_File_Chooser::update_preview()
previewBox->labelsize(size);
previewBox->labelfont(FL_COURIER);
}
+ } else if (image && ( (image->w() <= 0) ||
+ (image->h() <= 0) ||
+ (image->d() <= 0) )) {
+ // Image has errors? Show big 'X'
+ previewBox->label("X");
+ previewBox->align(FL_ALIGN_CLIP);
+ previewBox->labelsize(70);
+ previewBox->labelfont(FL_HELVETICA);
+ previewBox->redraw();
} else if (image) {
pbw = previewBox->w() - 20;
pbh = previewBox->h() - 20;