api_breed.lua:189: attempt to index local 'obj' (a nil value) #4324

Closed
opened 2023-04-28 12:29:52 +00:00 by AliasAlreadyTaken · 8 comments
2023-04-28 11:32:57: ERROR[Main]: ServerError: AsyncErr: Lua: Runtime error from mod 'petz' in callback luaentity_Step(): ....1/Minetest_live/bin/../mods/petz/petz/api/api_breed.lua:189: attempt to index local 'obj' (a nil value)
2023-04-28 11:32:57: ERROR[Main]: stack traceback:
2023-04-28 11:32:57: ERROR[Main]: 	....1/Minetest_live/bin/../mods/petz/petz/api/api_breed.lua:189: in function 'growth_timer'
2023-04-28 11:32:57: ERROR[Main]: 	.../Minetest_live/bin/../mods/petz/petz/api/api_on_step.lua:10: in function 'on_step'
2023-04-28 11:32:57: ERROR[Main]: 	...etest_live/bin/../mods/petz/petz/petz/chicken_mobkit.lua:151: in function 'func'
2023-04-28 11:32:57: ERROR[Main]: 	...inetest_live/bin/../builtin/profiler/instrumentation.lua:107: in function 'old_on_step'
2023-04-28 11:32:57: ERROR[Main]: 	...ve/bin/../mods/yl_commons/bugfixes/petz_spawn_height.lua:27: in function <...ve/bin/../mods/yl_commons/bugfixes/petz_spawn_height.lua:20>
``` 2023-04-28 11:32:57: ERROR[Main]: ServerError: AsyncErr: Lua: Runtime error from mod 'petz' in callback luaentity_Step(): ....1/Minetest_live/bin/../mods/petz/petz/api/api_breed.lua:189: attempt to index local 'obj' (a nil value) 2023-04-28 11:32:57: ERROR[Main]: stack traceback: 2023-04-28 11:32:57: ERROR[Main]: ....1/Minetest_live/bin/../mods/petz/petz/api/api_breed.lua:189: in function 'growth_timer' 2023-04-28 11:32:57: ERROR[Main]: .../Minetest_live/bin/../mods/petz/petz/api/api_on_step.lua:10: in function 'on_step' 2023-04-28 11:32:57: ERROR[Main]: ...etest_live/bin/../mods/petz/petz/petz/chicken_mobkit.lua:151: in function 'func' 2023-04-28 11:32:57: ERROR[Main]: ...inetest_live/bin/../builtin/profiler/instrumentation.lua:107: in function 'old_on_step' 2023-04-28 11:32:57: ERROR[Main]: ...ve/bin/../mods/yl_commons/bugfixes/petz_spawn_height.lua:27: in function <...ve/bin/../mods/yl_commons/bugfixes/petz_spawn_height.lua:20> ```
Author
Owner
2023-04-28 11:08:38: ERROR[Main]: ServerError: AsyncErr: Lua: Runtime error from mod 'petz' in callback luaentity_Step(): ....1/Minetest_live/bin/../mods/petz/petz/api/api_breed.lua:189: attempt to index local 'obj' (a nil value)
2023-04-28 11:08:38: ERROR[Main]: stack traceback:
2023-04-28 11:08:38: ERROR[Main]: 	....1/Minetest_live/bin/../mods/petz/petz/api/api_breed.lua:189: in function 'growth_timer'
2023-04-28 11:08:38: ERROR[Main]: 	.../Minetest_live/bin/../mods/petz/petz/api/api_on_step.lua:10: in function 'on_step'
2023-04-28 11:08:38: ERROR[Main]: 	...etest_live/bin/../mods/petz/petz/petz/chicken_mobkit.lua:151: in function 'func'
2023-04-28 11:08:38: ERROR[Main]: 	...inetest_live/bin/../builtin/profiler/instrumentation.lua:107: in function 'old_on_step'
2023-04-28 11:08:38: ERROR[Main]: 	...ve/bin/../mods/yl_commons/bugfixes/petz_spawn_height.lua:27: in function <...ve/bin/../mods/yl_commons/bugfixes/petz_spawn_height.lua:20>
``` 2023-04-28 11:08:38: ERROR[Main]: ServerError: AsyncErr: Lua: Runtime error from mod 'petz' in callback luaentity_Step(): ....1/Minetest_live/bin/../mods/petz/petz/api/api_breed.lua:189: attempt to index local 'obj' (a nil value) 2023-04-28 11:08:38: ERROR[Main]: stack traceback: 2023-04-28 11:08:38: ERROR[Main]: ....1/Minetest_live/bin/../mods/petz/petz/api/api_breed.lua:189: in function 'growth_timer' 2023-04-28 11:08:38: ERROR[Main]: .../Minetest_live/bin/../mods/petz/petz/api/api_on_step.lua:10: in function 'on_step' 2023-04-28 11:08:38: ERROR[Main]: ...etest_live/bin/../mods/petz/petz/petz/chicken_mobkit.lua:151: in function 'func' 2023-04-28 11:08:38: ERROR[Main]: ...inetest_live/bin/../builtin/profiler/instrumentation.lua:107: in function 'old_on_step' 2023-04-28 11:08:38: ERROR[Main]: ...ve/bin/../mods/yl_commons/bugfixes/petz_spawn_height.lua:27: in function <...ve/bin/../mods/yl_commons/bugfixes/petz_spawn_height.lua:20> ```
Author
Owner
2023-04-28 05:51:21: ERROR[Main]: ServerError: AsyncErr: Lua: Runtime error from mod 'petz' in callback luaentity_Step(): ....1/Minetest_live/bin/../mods/petz/petz/api/api_breed.lua:189: attempt to index local 'obj' (a nil value)
2023-04-28 05:51:21: ERROR[Main]: stack traceback:
2023-04-28 05:51:21: ERROR[Main]: 	....1/Minetest_live/bin/../mods/petz/petz/api/api_breed.lua:189: in function 'growth_timer'
2023-04-28 05:51:21: ERROR[Main]: 	.../Minetest_live/bin/../mods/petz/petz/api/api_on_step.lua:10: in function 'on_step'
2023-04-28 05:51:21: ERROR[Main]: 	...etest_live/bin/../mods/petz/petz/petz/chicken_mobkit.lua:151: in function 'func'
2023-04-28 05:51:21: ERROR[Main]: 	...inetest_live/bin/../builtin/profiler/instrumentation.lua:107: in function 'old_on_step'
2023-04-28 05:51:21: ERROR[Main]: 	...ve/bin/../mods/yl_commons/bugfixes/petz_spawn_height.lua:27: in function <...ve/bin/../mods/yl_commons/bugfixes/petz_spawn_height.lua:20>
2023-04-28 06:01:11: ERROR[Main]: The following mods could not be found: "junglegrass" "flowers_plus" "along_shore" "mokapi"
2023-04-28 07:01:21: ERROR[Main]: ServerError: AsyncErr: Lua: Runtime error from mod 'petz' in callback luaentity_Step(): ....1/Minetest_live/bin/../mods/petz/petz/api/api_breed.lua:189: attempt to index local 'obj' (a nil value)
2023-04-28 07:01:21: ERROR[Main]: stack traceback:
2023-04-28 07:01:21: ERROR[Main]: 	....1/Minetest_live/bin/../mods/petz/petz/api/api_breed.lua:189: in function 'growth_timer'
2023-04-28 07:01:21: ERROR[Main]: 	.../Minetest_live/bin/../mods/petz/petz/api/api_on_step.lua:10: in function 'on_step'
2023-04-28 07:01:21: ERROR[Main]: 	...etest_live/bin/../mods/petz/petz/petz/chicken_mobkit.lua:151: in function 'func'
2023-04-28 07:01:21: ERROR[Main]: 	...inetest_live/bin/../builtin/profiler/instrumentation.lua:107: in function 'old_on_step'
2023-04-28 07:01:21: ERROR[Main]: 	...ve/bin/../mods/yl_commons/bugfixes/petz_spawn_height.lua:27: in function <...ve/bin/../mods/yl_commons/bugfixes/petz_spawn_height.lua:20>
``` 2023-04-28 05:51:21: ERROR[Main]: ServerError: AsyncErr: Lua: Runtime error from mod 'petz' in callback luaentity_Step(): ....1/Minetest_live/bin/../mods/petz/petz/api/api_breed.lua:189: attempt to index local 'obj' (a nil value) 2023-04-28 05:51:21: ERROR[Main]: stack traceback: 2023-04-28 05:51:21: ERROR[Main]: ....1/Minetest_live/bin/../mods/petz/petz/api/api_breed.lua:189: in function 'growth_timer' 2023-04-28 05:51:21: ERROR[Main]: .../Minetest_live/bin/../mods/petz/petz/api/api_on_step.lua:10: in function 'on_step' 2023-04-28 05:51:21: ERROR[Main]: ...etest_live/bin/../mods/petz/petz/petz/chicken_mobkit.lua:151: in function 'func' 2023-04-28 05:51:21: ERROR[Main]: ...inetest_live/bin/../builtin/profiler/instrumentation.lua:107: in function 'old_on_step' 2023-04-28 05:51:21: ERROR[Main]: ...ve/bin/../mods/yl_commons/bugfixes/petz_spawn_height.lua:27: in function <...ve/bin/../mods/yl_commons/bugfixes/petz_spawn_height.lua:20> 2023-04-28 06:01:11: ERROR[Main]: The following mods could not be found: "junglegrass" "flowers_plus" "along_shore" "mokapi" 2023-04-28 07:01:21: ERROR[Main]: ServerError: AsyncErr: Lua: Runtime error from mod 'petz' in callback luaentity_Step(): ....1/Minetest_live/bin/../mods/petz/petz/api/api_breed.lua:189: attempt to index local 'obj' (a nil value) 2023-04-28 07:01:21: ERROR[Main]: stack traceback: 2023-04-28 07:01:21: ERROR[Main]: ....1/Minetest_live/bin/../mods/petz/petz/api/api_breed.lua:189: in function 'growth_timer' 2023-04-28 07:01:21: ERROR[Main]: .../Minetest_live/bin/../mods/petz/petz/api/api_on_step.lua:10: in function 'on_step' 2023-04-28 07:01:21: ERROR[Main]: ...etest_live/bin/../mods/petz/petz/petz/chicken_mobkit.lua:151: in function 'func' 2023-04-28 07:01:21: ERROR[Main]: ...inetest_live/bin/../builtin/profiler/instrumentation.lua:107: in function 'old_on_step' 2023-04-28 07:01:21: ERROR[Main]: ...ve/bin/../mods/yl_commons/bugfixes/petz_spawn_height.lua:27: in function <...ve/bin/../mods/yl_commons/bugfixes/petz_spawn_height.lua:20> ```
Author
Owner

Dumbfix:

petz.growth_timer = function(self, dtime)
        self.growth_time = kitz.remember(self, "growth_time", (self.growth_time or 0) + dtime)
        if self.growth_time >= petz.settings.growth_time then
                self.is_baby = kitz.remember(self, "is_baby", false)
                local pos = self.object:get_pos()
                pos.y = pos.y + 1.01 -- grows a litte up
                self.object:set_pos(pos)
                local obj
                if self.parents then -- for chicken only
                        kitz.remove_mob(self)
                        obj = minetest.add_entity(pos, self.parents[math.random(1, #self.parents)])
                else
                        obj = self.object
                        petz.set_properties(self, {
                                jump = false,
                                is_baby = false,
                                visual_size = self.visual_size,
                                collisionbox = self.collisionbox
                        })
                end
                if not obj and not obj.get_velocity then 
                        core.log("ERROR","#4324 Dumbfix self="..dump(self)..", obj="..dump(obj))
                        return 
                end
                local vel = obj:get_velocity()
                vel.y=vel.y + 4.0
                obj:set_velocity(vel)
                kitz.make_sound("object", obj, "petz_pop_sound", petz.settings.max_hear_distance)
        end
end
Dumbfix: ``` petz.growth_timer = function(self, dtime) self.growth_time = kitz.remember(self, "growth_time", (self.growth_time or 0) + dtime) if self.growth_time >= petz.settings.growth_time then self.is_baby = kitz.remember(self, "is_baby", false) local pos = self.object:get_pos() pos.y = pos.y + 1.01 -- grows a litte up self.object:set_pos(pos) local obj if self.parents then -- for chicken only kitz.remove_mob(self) obj = minetest.add_entity(pos, self.parents[math.random(1, #self.parents)]) else obj = self.object petz.set_properties(self, { jump = false, is_baby = false, visual_size = self.visual_size, collisionbox = self.collisionbox }) end if not obj and not obj.get_velocity then core.log("ERROR","#4324 Dumbfix self="..dump(self)..", obj="..dump(obj)) return end local vel = obj:get_velocity() vel.y=vel.y + 4.0 obj:set_velocity(vel) kitz.make_sound("object", obj, "petz_pop_sound", petz.settings.max_hear_distance) end end ```
Author
Owner
2023-04-28 12:47:12: ERROR[Main]: ServerError: AsyncErr: Lua: Runtime error from mod 'petz' in callback luaentity_Step(): ....1/Minetest_live/bin/../mods/petz/petz/api/api_breed.lua:189: attempt to index local 'obj' (a nil value)
2023-04-28 12:47:12: ERROR[Main]: stack traceback:
2023-04-28 12:47:12: ERROR[Main]: 	....1/Minetest_live/bin/../mods/petz/petz/api/api_breed.lua:189: in function 'growth_timer'
2023-04-28 12:47:12: ERROR[Main]: 	.../Minetest_live/bin/../mods/petz/petz/api/api_on_step.lua:10: in function 'on_step'
2023-04-28 12:47:12: ERROR[Main]: 	...etest_live/bin/../mods/petz/petz/petz/chicken_mobkit.lua:151: in function 'func'
2023-04-28 12:47:12: ERROR[Main]: 	...inetest_live/bin/../builtin/profiler/instrumentation.lua:107: in function 'old_on_step'
2023-04-28 12:47:12: ERROR[Main]: 	...ve/bin/../mods/yl_commons/bugfixes/petz_spawn_height.lua:27: in function <...ve/bin/../mods/yl_commons/bugfixes/petz_spawn_height.lua:20>
``` 2023-04-28 12:47:12: ERROR[Main]: ServerError: AsyncErr: Lua: Runtime error from mod 'petz' in callback luaentity_Step(): ....1/Minetest_live/bin/../mods/petz/petz/api/api_breed.lua:189: attempt to index local 'obj' (a nil value) 2023-04-28 12:47:12: ERROR[Main]: stack traceback: 2023-04-28 12:47:12: ERROR[Main]: ....1/Minetest_live/bin/../mods/petz/petz/api/api_breed.lua:189: in function 'growth_timer' 2023-04-28 12:47:12: ERROR[Main]: .../Minetest_live/bin/../mods/petz/petz/api/api_on_step.lua:10: in function 'on_step' 2023-04-28 12:47:12: ERROR[Main]: ...etest_live/bin/../mods/petz/petz/petz/chicken_mobkit.lua:151: in function 'func' 2023-04-28 12:47:12: ERROR[Main]: ...inetest_live/bin/../builtin/profiler/instrumentation.lua:107: in function 'old_on_step' 2023-04-28 12:47:12: ERROR[Main]: ...ve/bin/../mods/yl_commons/bugfixes/petz_spawn_height.lua:27: in function <...ve/bin/../mods/yl_commons/bugfixes/petz_spawn_height.lua:20> ```
Author
Owner
Upstream issue: https://github.com/runsy/petz/issues/166
AliasAlreadyTaken added the
1. kind/bug
3. source/mod upstream
2. prio/critical
ugh/petz
labels 2023-04-28 13:00:26 +00:00
AliasAlreadyTaken added this to the Alias@work project 2023-04-28 13:20:13 +00:00
Member

if not obj and not obj.get_velocity then

you want either if not obj or not obj.get_velocity or if not (obj and obj.get_velocity)

> `if not obj and not obj.get_velocity then` you want either `if not obj or not obj.get_velocity` or `if not (obj and obj.get_velocity)`
Author
Owner

Fixed upstream

Fixed upstream
AliasAlreadyTaken added this to the 1.1.120 milestone 2023-05-18 05:13:02 +00:00
AliasAlreadyTaken added the
4. step/ready to QA test
label 2023-05-18 05:13:06 +00:00
AliasAlreadyTaken removed this from the Alias@work project 2023-07-21 15:02:53 +00:00
AliasAlreadyTaken added the
ugh/QA main
label 2023-08-28 14:34:05 +00:00
Author
Owner

Hasn't happened ever since

Hasn't happened ever since
AliasAlreadyTaken added
5. result/fixed
and removed
4. step/ready to QA test
labels 2023-11-27 01:28:15 +00:00
Sign in to join this conversation.
No Milestone
No project
No Assignees
2 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: your-land/bugtracker#4324
No description provided.