Skip to content

Commit 950ff65

Browse files
committed
Update CCTiledMapLayer.m
Fixes possible divide by zero. If the layer has no tileset, the tex is nil and causes pixelsToPoints to be INF. This causes the contentSize to be INF, INF and prevents any further layers from being parsed.
1 parent c743e77 commit 950ff65

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

cocos2d/CCTiledMapLayer.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ -(id) initWithTilesetInfo:(CCTiledMapTilesetInfo*)tilesetInfo layerInfo:(CCTiled
117117
_mapTileSize = mapInfo.tileSize;
118118
_layerOrientation = mapInfo.orientation;
119119

120-
CGFloat pixelsToPoints = 1.0/tex.contentScale;
120+
CGFloat pixelsToPoints = tex ? 1.0/tex.contentScale : 1.0;
121121

122122
// offset (after layer orientation is set);
123123
CGPoint offset = [self calculateLayerOffset:layerInfo.offset];

0 commit comments

Comments
 (0)