Added error checking to Vector2::Normalize()
This commit is contained in:
@@ -43,6 +43,8 @@ public:
|
||||
}
|
||||
void Normalize() {
|
||||
double l = Length();
|
||||
if (l == 0)
|
||||
throw(std::domain_error("Divide by zero"));
|
||||
x /= l;
|
||||
y /= l;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user