Skip to content

Commit

Permalink
Fixes STR#2991: prevents crash when file browser
Browse files Browse the repository at this point in the history
                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
  • Loading branch information
erco77 committed Oct 21, 2013
1 parent da18713 commit 45d7ae0
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/Fl_File_Chooser2.cxx
Expand Up @@ -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;
Expand Down

0 comments on commit 45d7ae0

Please sign in to comment.