diff --git a/Extensions/CCLayerPanZoom/CCLayerPanZoom.m b/Extensions/CCLayerPanZoom/CCLayerPanZoom.m index d2c2fe2..ee910b7 100644 --- a/Extensions/CCLayerPanZoom/CCLayerPanZoom.m +++ b/Extensions/CCLayerPanZoom/CCLayerPanZoom.m @@ -219,7 +219,7 @@ - (id) init - (void) ccTouchesBegan: (NSSet *) touches withEvent: (UIEvent *) event -{ +{ for (UITouch *touch in [touches allObjects]) { // Add new touche to the array with current touches @@ -238,6 +238,13 @@ - (void) ccTouchesBegan: (NSSet *) touches - (void) ccTouchesMoved: (NSSet *) touches withEvent: (UIEvent *) event { + // Fixes issue #108: + // ccTouchesMoved should never be called if ccTouchesBegan is not called first. + // However, when the scene is transitioning in, ccTouchesBegan is not called, + // causing self.touches to be empty, thus crashing the app due to an attempt + // to access an empty array. + if ([self.touches count] == 0) return; + BOOL multitouch = [self.touches count] > 1; if (multitouch) {