Permalink
Browse files

Don't try to split undefined values in $_[0]->{lines}

  • Loading branch information...
1 parent dcdd428 commit 224db1b2d19ea47957f78b34287fb37fcdf3b655 @chiselwright chiselwright committed Sep 15, 2011
Showing with 4 additions and 2 deletions.
  1. +4 −2 lib/Plack/Middleware/Debug/Base.pm
@@ -128,11 +128,13 @@ my $line_template = __PACKAGE__->build_template(<<'EOTMPL');
<table>
<tbody>
% my $i;
-% my @lines = ref $_[0]->{lines} eq 'ARRAY' ? @{$_[0]->{lines}} : split /\r?\n/, $_[0]->{lines};
-% for my $line (@lines) {
+% if (defined $_[0]->{lines}) {
+% my @lines = ref $_[0]->{lines} eq 'ARRAY' ? @{$_[0]->{lines}} : split /\r?\n/, $_[0]->{lines};
+% for my $line (@lines) {
<tr class="<%= ++$i % 2 ? 'plDebugEven' : 'plDebugOdd' %>">
<td><%= $line %></td>
</tr>
+% }
% }
</tbody>
</table>

0 comments on commit 224db1b

Please sign in to comment.