Skip to content

Commit 5992045

Browse files
author
BoboTiG
committed
MSSMac: restore exception on CGImageDestinationCreateWithURL()
1 parent ed77b60 commit 5992045

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

mss.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -295,17 +295,17 @@ def get_pixels(self, monitor):
295295
return self.image
296296

297297
def save_img(self, data, width, height, output):
298-
''' Use my own save_img() method. Because I'm Mac! '''
298+
''' Use my own save_img() method. Because I'm a Mac! '''
299299

300-
self.debug('MSSMac: save_img')
300+
self.debug('save_img')
301301

302302
url = NSURL.fileURLWithPath_(output)
303-
if CGImageDestinationCreateWithURL(url, kUTTypePNG, 1, None):
304-
CGImageDestinationAddImage(dest, data, None)
305-
if CGImageDestinationFinalize(dest):
306-
return
307-
err = 'MSS: error writing to file "{0}".'.format(output)
308-
raise ScreenshotError(err)
303+
if not CGImageDestinationCreateWithURL(url, kUTTypePNG, 1, None):
304+
err = 'MSS : CGImageDestinationCreateWithURL() failed.'
305+
raise ScreenshotError(err)
306+
CGImageDestinationAddImage(dest, data, None)
307+
if not CGImageDestinationFinalize(dest):
308+
raise ScreenshotError('MSS: CGImageDestinationFinalize() failed.')
309309

310310

311311
class MSSLinux(MSS):

0 commit comments

Comments
 (0)