fix: avoids crashing when selected_action is null (#586)

* fix: avoids crashing when selected_action is null
* fix: more robust handling suggested by @straton
This commit is contained in:
Duncan Brown
2022-04-30 15:50:55 -04:00
committed by GitHub
parent 422db46f87
commit f9e39af798

View File

@@ -180,6 +180,14 @@ func left_click_on_item(item_global_id: String, event: InputEvent) -> void:
func right_click_on_item(item_global_id: String, event: InputEvent) -> void:
element_focused(item_global_id)
var object = escoria.object_manager.get_object(item_global_id)
if object != null:
verbs_menu.set_by_name(object.node.default_action)
if verbs_menu.selected_action == null:
return
escoria.action_manager.set_current_action(verbs_menu.selected_action)
escoria.action_manager.do(
escoria.action_manager.ACTION.ITEM_RIGHT_CLICK,