summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAlbrecht Schlosser <albrechts.fltk@online.de>2016-11-02 11:50:18 +0000
committerAlbrecht Schlosser <albrechts.fltk@online.de>2016-11-02 11:50:18 +0000
commitfdbf4267827266579d35678736032c87bbba0914 (patch)
tree441db0057f35643ca50a04d1d09b61185b70ebd7 /src
parentaf2dc3bce82b777376e755d7b329a25b8764d556 (diff)
Accept empty Fl_Pixmap in Fl_RGB_Image c'tor (STR #3348).
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3-porting@12074 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src')
-rw-r--r--src/Fl_Image.cxx10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/Fl_Image.cxx b/src/Fl_Image.cxx
index 7c3233c89..817613c87 100644
--- a/src/Fl_Image.cxx
+++ b/src/Fl_Image.cxx
@@ -290,12 +290,16 @@ Fl_RGB_Image::Fl_RGB_Image(const uchar *bits, int W, int H, int D, int LD) :
*/
Fl_RGB_Image::Fl_RGB_Image(const Fl_Pixmap *pxm, Fl_Color bg):
Fl_Image(pxm->w(), pxm->h(), 4),
+ array(0),
+ alloc_array(0),
id_(0),
mask_(0)
{
- array = new uchar[w() * h() * d()];
- alloc_array = 1;
- fl_convert_pixmap(pxm->data(), (uchar*)array, bg);
+ if (pxm && pxm->w() > 0 && pxm->h() > 0) {
+ array = new uchar[w() * h() * d()];
+ alloc_array = 1;
+ fl_convert_pixmap(pxm->data(), (uchar*)array, bg);
+ }
data((const char **)&array, 1);
}