From f71798a35b12e84af0836e81fd8a11c17fc1cdfb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adrien=20B=C3=A9raud?= Date: Tue, 7 May 2013 02:59:38 +1000 Subject: [PATCH] Check for 0 length in CCPoint::normalize() --- cocos2dx/cocoa/CCGeometry.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/cocos2dx/cocoa/CCGeometry.h b/cocos2dx/cocoa/CCGeometry.h index 76d1a8c330..b1f3f1d055 100644 --- a/cocos2dx/cocoa/CCGeometry.h +++ b/cocos2dx/cocoa/CCGeometry.h @@ -170,6 +170,8 @@ public: @since v2.1.4 */ inline CCPoint normalize() const { + float length = getLength(); + if(length == 0.) return CCPoint(*this); return *this / getLength(); };