[Custom Views] Wrap ingameui methods in safe calls

This commit is contained in:
Azumgi 2018-11-10 18:46:32 +03:00
parent da2cdc669d
commit 180edd4075

View file

@ -45,7 +45,11 @@ local ERRORS = {
PREFIX = {
register_view_validating = "[Custom Views] (register_view) View data validating '%s'",
register_view_injection = "[Custom Views] (register_view) View injection '%s'",
ingameui_hook_injection = "[Custom Views] View injection '%s'"
ingameui_hook_injection = "[Custom Views] View injection '%s'",
handle_transition_fade = "[Custom Views] (handle_transition) executing 'ingame_ui.transition_with_fade' for " ..
"transition '%s'",
handle_transition_no_fade = "[Custom Views] (handle_transition) executing 'ingame_ui.handle_transition' for " ..
"transition '%s'"
}
}
@ -265,9 +269,11 @@ function VMFMod:handle_transition(transition_name, transition_params, fade, igno
)
then
if fade then
_ingame_ui:transition_with_fade(transition_name, transition_params)
vmf.safe_call_nr(self, ERRORS.THROWABLE["handle_transition_fade"], _ingame_ui.transition_with_fade, _ingame_ui,
transition_name, transition_params)
else
_ingame_ui:handle_transition(transition_name, transition_params)
vmf.safe_call_nr(self, ERRORS.THROWABLE["handle_transition_no_fade"], _ingame_ui.handle_transition, _ingame_ui,
transition_name, transition_params)
end
return true
end