diff options
| author | jackpoz <giacomopoz@gmail.com> | 2019-07-21 16:21:43 +0200 |
|---|---|---|
| committer | jackpoz <giacomopoz@gmail.com> | 2019-07-21 16:21:43 +0200 |
| commit | 2bac44c7d04f490e08d209d4d1e17bc51e61eb8b (patch) | |
| tree | f9d712fa4a3c607c0258dd3baaaa333cddf325ea /src | |
| parent | c4c739fea5c6f870f4303e4b2b5998dc28b590f9 (diff) | |
Core/Spline: Fix crash
Fix crash when calling MoveSpline::ToString() on an empty spline
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 9bdc77f9427..dc0f73f0e98 100644 --- a/src/server/game/Movement/Spline/Spline.h +++ b/src/server/game/Movement/Spline/Spline.h @@ -201,7 +201,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];} |
