diff options
| author | jackpoz <giacomopoz@gmail.com> | 2019-07-21 16:21:43 +0200 |
|---|---|---|
| committer | Shauren <shauren.trinity@gmail.com> | 2021-12-17 00:27:09 +0100 |
| commit | e998a1169d9570ae1fe44683287eaf443b573089 (patch) | |
| tree | a57b5ac44becbb215a2fd92203a6ef2134f617bc /src | |
| parent | a4c2c0fb1d1b9fae832ecc52aa68fe3fb8d1ca52 (diff) | |
Core/Spline: Fix crash
Fix crash when calling MoveSpline::ToString() on an empty spline
(cherry picked from commit 2bac44c7d04f490e08d209d4d1e17bc51e61eb8b)
Diffstat (limited to 'src')
| -rw-r--r-- | src/server/game/Movement/Spline/Spline.h | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/server/game/Movement/Spline/Spline.h b/src/server/game/Movement/Spline/Spline.h index f45c04551a2..3f20e2bed72 100644 --- a/src/server/game/Movement/Spline/Spline.h +++ b/src/server/game/Movement/Spline/Spline.h @@ -200,7 +200,12 @@ public: } /** Returns length of the whole spline. */ - length_type length() const { return lengths[index_hi];} + length_type length() const + { + if (lengths.empty()) + return 0; + return lengths[index_hi]; + } /** Returns length between given nodes. */ length_type length(index_type first, index_type last) const { return lengths[last]-lengths[first];} length_type length(index_type Idx) const { return lengths[Idx];} |
