From 4eee9f1f63fa81e64c15e0659231475a0c2d6ce7 Mon Sep 17 00:00:00 2001 From: Manolo Gouy Date: Wed, 22 Jan 2014 20:39:21 +0000 Subject: 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 --- src/fl_scroll_area.cxx | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'src/fl_scroll_area.cxx') 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 -- cgit v1.2.3