diff options
| author | Manolo Gouy <Manolo> | 2014-01-22 20:39:21 +0000 |
|---|---|---|
| committer | Manolo Gouy <Manolo> | 2014-01-22 20:39:21 +0000 |
| commit | 4eee9f1f63fa81e64c15e0659231475a0c2d6ce7 (patch) | |
| tree | a6bcc7a947f75c03e6e5b28e7db89a19f66f9078 /src/Fl_cocoa.mm | |
| parent | 4d5e10097e3561c8d83698da03713a489bf254ff (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_cocoa.mm')
| -rw-r--r-- | src/Fl_cocoa.mm | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/Fl_cocoa.mm b/src/Fl_cocoa.mm index 814604f22..14ea72303 100644 --- a/src/Fl_cocoa.mm +++ b/src/Fl_cocoa.mm @@ -3351,6 +3351,7 @@ unsigned char *Fl_X::bitmap_from_window_rect(Fl_Window *win, int x, int y, int w */ { NSBitmapImageRep *bitmap = rect_to_NSBitmapImageRep(win, x, y, w, h); + if (bitmap == nil) return NULL; *bytesPerPixel = [bitmap bitsPerPixel]/8; int bpp = (int)[bitmap bytesPerPlane]; int bpr = (int)[bitmap bytesPerRow]; @@ -3388,6 +3389,7 @@ CGImageRef Fl_X::CGImage_from_window_rect(Fl_Window *win, int x, int y, int w, i else { int bpp; unsigned char *bitmap = bitmap_from_window_rect(win, x, y, w, h, &bpp); + if (!bitmap) return NULL; CGColorSpaceRef lut = CGColorSpaceCreateDeviceRGB(); CGDataProviderRef provider = CGDataProviderCreateWithData(NULL, bitmap, w*h*bpp, imgProviderReleaseData); img = CGImageCreate(w, h, 8, 8*bpp, w*bpp, lut, |
