Prevent the symptoms of Issue #33

Try to prevent the crash from issue #33 by
replaving nil velocity or acceleration with (0,0,0).
This does not fix the underlying cause of them being nil,
but should prevent the crash.
This commit is contained in:
Skgland 2020-12-18 19:21:39 +01:00
parent 065c953eba
commit ba7eb19317
No known key found for this signature in database
GPG Key ID: 3BE1A1A3CBC3CF99
1 changed files with 2 additions and 0 deletions

View File

@ -340,6 +340,8 @@ local move_entities_globalstep_part2 = function(dtime)
entity._velocity = master_entity:get_velocity()
entity._acceleration = master_entity:get_acceleration()
else
entity._velocity = entity._velocity or vector.new(0,0,0)
entity._acceleration = entity._acceleration or vector.new(0,0,0)
entity._pos = vector.add(vector.add(
entity._pos,
vector.multiply(entity._velocity, dtime)),