summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorManolo Gouy <Manolo>2016-04-27 16:42:20 +0000
committerManolo Gouy <Manolo>2016-04-27 16:42:20 +0000
commitf4ec7192a9f2c3ada9f7676ca90942306f910db3 (patch)
tree332be43a0ec07951d86029126a54840ddd981a5d /test
parent425fe6ac8c31ff1500a1745d67aa6bbe781f5328 (diff)
Add tests to avoid null pointer errors
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3-porting@11703 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'test')
-rw-r--r--test/device.cxx14
1 files changed, 8 insertions, 6 deletions
diff --git a/test/device.cxx b/test/device.cxx
index 1cb7ec6ab..0246de4d1 100644
--- a/test/device.cxx
+++ b/test/device.cxx
@@ -574,12 +574,14 @@ void copy(Fl_Widget *, void *data) {
Fl_Image *img = rgb_surf->highres_image();
delete rgb_surf;
Fl_Display_Device::display_device()->set_current();
- Fl_Window* g2 = new Fl_Window(img->w()+10, img->h()+10);
- g2->color(FL_YELLOW);
- Fl_Box *b = new Fl_Box(FL_NO_BOX,5,5,img->w(), img->h(),0);
- b->image(img);
- g2->end();
- g2->show();
+ if (img) {
+ Fl_Window* g2 = new Fl_Window(img->w()+10, img->h()+10);
+ g2->color(FL_YELLOW);
+ Fl_Box *b = new Fl_Box(FL_NO_BOX,5,5,img->w(), img->h(),0);
+ b->image(img);
+ g2->end();
+ g2->show();
+ }
return;
}