From f8a4fa095f622e783f2e27bfba86c0234a5983cf Mon Sep 17 00:00:00 2001 From: Marius Gavrilescu Date: Sat, 11 Apr 2015 15:07:55 +0300 Subject: [PATCH] Do not crash when passing undef to literal --- lib/Plack/App/Gruntmaster/HTML.pm | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/Plack/App/Gruntmaster/HTML.pm b/lib/Plack/App/Gruntmaster/HTML.pm index 3cfbc54..9f6f2ec 100644 --- a/lib/Plack/App/Gruntmaster/HTML.pm +++ b/lib/Plack/App/Gruntmaster/HTML.pm @@ -11,9 +11,11 @@ use Data::Dumper qw/Dumper/; sub ftime ($) { POSIX::strftime '%c', localtime shift } sub literal ($) { + my ($html) = @_; + return unless $html; my $b = HTML::TreeBuilder->new; $b->ignore_unknown(0); - $b->parse(shift // ''); + $b->parse($html); HTML::Element::Library::super_literal $b->guts->as_HTML; } -- 2.39.2