- Lazy checks for preventing crash when drawing 'nice hogs' on config screen (frontend) on iPad. Now we have animation glitch sometimes, but this is preferable to crash anyway ios-develop
authorantonc27 <antonc27@mail.ru>
Fri, 29 Dec 2017 22:35:36 +0100
branchios-develop
changeset 12875 350d8bde5ccd
parent 12874 941674281760
child 12876 2c06b1120749
- Lazy checks for preventing crash when drawing 'nice hogs' on config screen (frontend) on iPad. Now we have animation glitch sometimes, but this is preferable to crash anyway
project_files/HedgewarsMobile/Classes/GameConfigViewController.m
--- a/project_files/HedgewarsMobile/Classes/GameConfigViewController.m	Fri Dec 29 19:38:01 2017 +0100
+++ b/project_files/HedgewarsMobile/Classes/GameConfigViewController.m	Fri Dec 29 22:35:36 2017 +0100
@@ -274,12 +274,14 @@
                 UIImage *hatSpriteFrame = [hatSprite cutAt:CGRectMake(x, y, 32, 32)];
                 UIImage *hogSpriteFrame = [hogSprite cutAt:CGRectMake(x, y, 32, 32)];
                 UIImage *hogWithHat = [hogSpriteFrame mergeWith:hatSpriteFrame atPoint:CGPointMake(0, 5)];
-                [animation addObject:hogWithHat];
+                if (hogWithHat) {
+                    [animation addObject:hogWithHat];
+                }
             }
             [hatSprite release];
             [hatFile release];
 
-            UIImageView *hog = [[UIImageView alloc] initWithImage:[animation objectAtIndex:0]];
+            UIImageView *hog = [[UIImageView alloc] initWithImage:[animation firstObject]];
             hog.animationImages = animation;
             hog.animationDuration = 3;
             [animation release];