Skip to content

Commit

Permalink
Doors: Avoid crash on nil player in 'can dig door'
Browse files Browse the repository at this point in the history
  • Loading branch information
paramat committed Feb 3, 2018
1 parent 12f1703 commit d5907d5
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions mods/doors/init.lua
Expand Up @@ -203,12 +203,7 @@ end

local function can_dig_door(pos, digger)
replace_old_owner_information(pos)
if default.can_interact_with_node(digger, pos) then
return true
else
minetest.record_protection_violation(pos, digger:get_player_name())
return false
end
return default.can_interact_with_node(digger, pos)
end

function doors.register(name, def)
Expand Down

3 comments on commit d5907d5

@alexerate
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not use if not digger then return false end instead of removing the minetest.record_protection_violation(pos, digger:get_player_name()) ?

record_protection_violation is used by some mods and can't be handled now.

@paramat
Copy link
Contributor Author

@paramat paramat commented on d5907d5 Feb 8, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@alexerate
Copy link

@alexerate alexerate commented on d5907d5 Feb 9, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct me if i'm wrong, but since you removed minetest.record_protection_violation, we can't use minetest.register_on_protection_violation to catch protection event of locked doors.

Please sign in to comment.