mirror of https://github.com/axmolengine/axmol.git
Check for 0 length in CCPoint::normalize()
This commit is contained in:
parent
49474f5194
commit
f71798a35b
|
@ -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();
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue