Fix crash with ghast achievement fireball_redir_serv #4179

Merged
the-real-herowl merged 1 commits from Araca/MineClone2:master into ghast_fixes 2024-05-02 00:15:58 +02:00
Contributor

My server crash a lot since I updated yesterday into master branch.

Logs

2024-02-04 16:56:38: ERROR[Main]: ServerError: AsyncErr: Lua: Runtime error from mod '' in callback luaentity_Step(): .../bin/../games/mineclone2/mods/ENTITIES/mobs_mc/ghast.lua:136: attempt to index field '_puncher' (a nil value)
2024-02-04 16:56:38: ERROR[Main]: stack traceback:
2024-02-04 16:56:38: ERROR[Main]:       .../bin/../games/mineclone2/mods/ENTITIES/mobs_mc/ghast.lua:136: in function 'hit_mob'
2024-02-04 16:56:38: ERROR[Main]:       .../bin/../games/mineclone2/mods/ENTITIES/mcl_mobs/init.lua:464: in function 'on_step_old'
2024-02-04 16:56:38: ERROR[Main]:       ...mes/mineclone2/mods/ENVIRONMENT/mcl_void_damage/init.lua:24: in function <...mes/mineclone2/mods/ENVIRONMENT/mcl_void_damage/init.lua:23>

self._puncher is nil

My guess on "Why", is that a ghast was spawn before I updated the server and as a consequence, it doesn't have the new attribute _puncher

My server crash a lot since I updated yesterday into master branch. Logs ``` 2024-02-04 16:56:38: ERROR[Main]: ServerError: AsyncErr: Lua: Runtime error from mod '' in callback luaentity_Step(): .../bin/../games/mineclone2/mods/ENTITIES/mobs_mc/ghast.lua:136: attempt to index field '_puncher' (a nil value) 2024-02-04 16:56:38: ERROR[Main]: stack traceback: 2024-02-04 16:56:38: ERROR[Main]: .../bin/../games/mineclone2/mods/ENTITIES/mobs_mc/ghast.lua:136: in function 'hit_mob' 2024-02-04 16:56:38: ERROR[Main]: .../bin/../games/mineclone2/mods/ENTITIES/mcl_mobs/init.lua:464: in function 'on_step_old' 2024-02-04 16:56:38: ERROR[Main]: ...mes/mineclone2/mods/ENVIRONMENT/mcl_void_damage/init.lua:24: in function <...mes/mineclone2/mods/ENVIRONMENT/mcl_void_damage/init.lua:23> ``` self._puncher is `nil` My guess on "Why", is that a ghast was spawn before I updated the server and as a consequence, it doesn't have the new attribute `_puncher`

This is not guaranteed to work because of operator associativity (and is to or like × is to +). Also now that I looked at the code again, it seems there may be more problems than just this...

This is not guaranteed to work because of operator associativity (and is to or like × is to +). Also now that I looked at the code again, it seems there may be more problems than just this...
Araca reviewed 2024-02-04 22:15:58 +01:00
@ -133,3 +133,3 @@
mcl_mobs.mob_class.boom(self,self.object:get_pos(), 1, true)
local ent = mob:get_luaentity()
if not ent or ent.health <= 0 then
if not ent or ent.health <= 0 and self._puncher then
Author
Contributor

Damned you are right, I was to fast.

This should work : if (not ent or ent.health <= 0) and self._puncher then

Damned you are right, I was to fast. This should work : `if (not ent or ent.health <= 0) and self._puncher then`
Araca force-pushed master from 82f37daef2 to eb8b5cc5da 2024-02-04 22:22:48 +01:00 Compare
Araca force-pushed master from eb8b5cc5da to c791622d60 2024-02-08 07:07:21 +01:00 Compare
the-real-herowl added the
#P1 CRITICAL
label 2024-03-07 21:14:25 +01:00
the-real-herowl added the
#Review
label 2024-04-29 18:23:07 +02:00
the-real-herowl added this to the 0.87.0 - Prismatic milestone 2024-04-29 18:23:17 +02:00
rudzik8 approved these changes 2024-04-30 16:12:04 +02:00
rudzik8 left a comment
Member

No issues found, pretty straight-forward fix.

No issues found, pretty straight-forward fix.
the-real-herowl changed title from Fix crash with ghast achievement fireball_redir_serv to Fix crash with ghast achievement fireball_redir_serv 2024-05-02 00:14:46 +02:00
the-real-herowl changed target branch from master to ghast_fixes 2024-05-02 00:14:47 +02:00
the-real-herowl removed the
#Review
label 2024-05-02 00:14:56 +02:00
the-real-herowl merged commit cd0509c2e6 into ghast_fixes 2024-05-02 00:15:58 +02:00
Sign in to join this conversation.
No reviewers
No project
No Assignees
3 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: VoxeLibre/VoxeLibre#4179
No description provided.