Skip to content

Commit 6993e06

Browse files
author
Thayer J Andrews
committed
CCEffectUtils - Better error handling when finding node to node transforms
If there is no common ancestor indicate as much and return early with the identity transform as the result.
1 parent 85d98ee commit 6993e06

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

cocos2d/CCEffectUtils.m

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,10 @@ GLKMatrix4 CCEffectUtilsTransformFromNodeToNode(CCNode *first, CCNode *second, B
4848
{
4949
*isPossible = (commonAncestor != nil);
5050
}
51+
if (commonAncestor == nil)
52+
{
53+
return GLKMatrix4Identity;
54+
}
5155

5256
// Compute the transform from this node to the common ancestor
5357
CGAffineTransform t1 = [first nodeToParentTransform];

0 commit comments

Comments
 (0)