diff --git a/src/Fl_Image.cxx b/src/Fl_Image.cxx index a6c63840b..a148551fa 100644 --- a/src/Fl_Image.cxx +++ b/src/Fl_Image.cxx @@ -202,7 +202,7 @@ void Fl_Image::label(Fl_Menu_Item* m) { */ int Fl_Image::fail() const { // if no image exists, ld_ may contain a simple error code - if ((w_ <= 0) || (h_ <= 0) || (d_ <= 0)) { + if ((w_ <= 0) || (h_ <= 0) || (d_ <= 0 && count_ == 0)) { if (ld_ == 0) return ERR_NO_IMAGE; else diff --git a/test/gl_image.cxx b/test/gl_image.cxx index 8114b9d5c..3f64846e1 100644 --- a/test/gl_image.cxx +++ b/test/gl_image.cxx @@ -96,7 +96,7 @@ void chooser_cb(Fl_Widget *, Gl_Image_Window *mainwin) { char *fname = fl_file_chooser("select image file", "*.{png,jpg,gif,svg,svgz,xbm,xpm,ico}", NULL, 0); if (fname) { Fl_Shared_Image *shared = Fl_Shared_Image::get(fname); - if (shared && shared->w() && shared->h()) { + if (shared && !shared->fail()) { mainwin->copy_label(fname); mainwin->set_image(shared); }