From: Marius Gavrilescu Date: Sat, 11 Apr 2015 12:07:55 +0000 (+0300) Subject: Do not crash when passing undef to literal X-Git-Url: http://git.ieval.ro/?p=plack-app-gruntmaster.git;a=commitdiff_plain;h=f8a4fa095f622e783f2e27bfba86c0234a5983cf Do not crash when passing undef to literal --- 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; }