#REFACTORING by stefan
authorStefan Vogel <sv@exept.de>
Wed, 08 Feb 2017 19:44:06 +0100
changeset 3868 d60663c87c61
parent 3867 9b2f1d48773a
child 3869 5d4df7d04f64
#REFACTORING by stefan class: MacOSXIconReader changed: #readSingleIcon:from: refactor return with exception handler
MacOSXIconReader.st
--- a/MacOSXIconReader.st	Wed Feb 08 00:57:34 2017 +0100
+++ b/MacOSXIconReader.st	Wed Feb 08 19:44:06 2017 +0100
@@ -169,12 +169,11 @@
 readSingleIcon:iconType from:iconBytes
     "read a single image from the inputStream."
 
-    |img|
-
-    Error handle:[:ex |
+    ^ Error handle:[:ex |
         self fileFormatError:'internal error / unhandled icon format: ',iconType.
+        nil
     ] do:[
-        img := self 
+        self 
             perform:('read_',(iconType copyReplaceAny:#( $# $ ) with:$_),'_from:') asSymbol 
             with:iconBytes
             ifNotUnderstood:[
@@ -184,12 +183,13 @@
                 nil
             ].
     ].
-    ^ img.
 
     "
      self fromFile:'/Applications/TextEdit.app/Contents/Resources/txt.icns'
      self fromFile:'test.icns'
     "
+
+    "Modified: / 08-02-2017 / 19:08:05 / stefan"
 ! !
 
 !MacOSXIconReader methodsFor:'image writing'!