Skip to content

Commit

Permalink
fix: imbuement shrine use on non-item objects (opentibiabr#905)
Browse files Browse the repository at this point in the history
Fix undefined behaviour when you use the imbuement shrine on a non item type.
  • Loading branch information
marcosvf132 authored Mar 6, 2023
1 parent 3a5e038 commit fe9419c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions data-canary/scripts/actions/imbuement_shrine.lua
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ function imbuement.onUse(player, item, fromPosition, target, toPosition, isHotke
return player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You did not collect enough knowledge from the ancient Shapers. Visit the Shaper temple in Montag for help.")
end

if not(target) or not(target:isItem()) then
return player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You can only use the shrine on an valid item.")
end

player:openImbuementWindow(target)
return true
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ function imbuement.onUse(player, item, fromPosition, target, toPosition, isHotke
return player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You did not collect enough knowledge from the ancient Shapers. Visit the Shaper temple in Thais for help.")
end

if not(target) or not(target:isItem()) then
return player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You can only use the shrine on an valid item.")
end

player:openImbuementWindow(target)
return true
end
Expand Down

0 comments on commit fe9419c

Please sign in to comment.