Fix Fl_Image::fail() that reported always failure for Fl_Bitmap's.

This commit is contained in:
ManoloFLTK
2026-04-03 15:27:00 +02:00
parent 1e2d7d2a95
commit ad537eddce
2 changed files with 2 additions and 2 deletions
+1 -1
View File
@@ -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
+1 -1
View File
@@ -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);
}