summaryrefslogtreecommitdiff
path: root/src/fl_scroll_area.cxx
diff options
context:
space:
mode:
authorManolo Gouy <Manolo>2014-01-22 20:39:21 +0000
committerManolo Gouy <Manolo>2014-01-22 20:39:21 +0000
commit4eee9f1f63fa81e64c15e0659231475a0c2d6ce7 (patch)
treea6bcc7a947f75c03e6e5b28e7db89a19f66f9078 /src/fl_scroll_area.cxx
parent4d5e10097e3561c8d83698da03713a489bf254ff (diff)
Mac OS: handle possible NULL return after screen capture attempt.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@10078 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src/fl_scroll_area.cxx')
-rw-r--r--src/fl_scroll_area.cxx12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/fl_scroll_area.cxx b/src/fl_scroll_area.cxx
index 7531f3d90..a8cba57c4 100644
--- a/src/fl_scroll_area.cxx
+++ b/src/fl_scroll_area.cxx
@@ -143,11 +143,13 @@ void fl_scroll(int X, int Y, int W, int H, int dx, int dy,
#elif defined(__APPLE_QUARTZ__)
CGImageRef img = Fl_X::CGImage_from_window_rect(Fl_Window::current(), src_x, src_y, src_w, src_h);
- CGRect rect = { { dest_x, dest_y }, { src_w, src_h } };
- Fl_X::q_begin_image(rect, 0, 0, src_w, src_h);
- CGContextDrawImage(fl_gc, rect, img);
- Fl_X::q_end_image();
- CFRelease(img);
+ if (img) {
+ CGRect rect = { { dest_x, dest_y }, { src_w, src_h } };
+ Fl_X::q_begin_image(rect, 0, 0, src_w, src_h);
+ CGContextDrawImage(fl_gc, rect, img);
+ Fl_X::q_end_image();
+ CFRelease(img);
+ }
#else
# error unsupported platform
#endif