diff --git a/lib/WebGUI/Macro/PickLanguage.pm b/lib/WebGUI/Macro/PickLanguage.pm index 750867efd..a59aead4d 100644 --- a/lib/WebGUI/Macro/PickLanguage.pm +++ b/lib/WebGUI/Macro/PickLanguage.pm @@ -44,8 +44,10 @@ This macro takes a templateId to show the links sub process { my $session = shift; my $templateId = shift || "_aE16Rr1-bXBf8SIaLZjCg"; - my $template = WebGUI::Asset::Template->newById($session, $templateId); + my $template = eval { WebGUI::Asset::Template->newById($session, $templateId); }; + if (Exception::Class->caught()) { return "Could not instanciate template with id [$templateId]" unless $template; + } my $i18n = WebGUI::International->new($session); my $languages = $i18n->getLanguages(); my @lang_loop = ();