Skip to content

Commit

Permalink
Adding error handling for instances where regex does not find require…
Browse files Browse the repository at this point in the history
…d elements

Upon installing in Laravel 4.2, the log viewer threw an exception because one line failed to populate the $current array from the regex. These changes allow it to keep going when this happens and render the page properly.
  • Loading branch information
eblount committed Apr 7, 2015
1 parent 6deebf4 commit 390c297
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Rap2hpoutre/LaravelLogViewer/LaravelLogViewer.php
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,8 @@ public static function all()
'level' => $ll,
'level_class' => $levels_classes[$ll],
'level_img' => $levels_imgs[$ll],
'date' => $current[1],
'text' => $current[2],
'date' => isset($current[1]) ? $current[1] : null,
'text' => isset($current[2]) ? $current[2] : null,
'in_file' => isset($current[3]) ? $current[3] : null,
'stack' => preg_replace("/^\n*/", '', $log_data[$i])
);
Expand Down

0 comments on commit 390c297

Please sign in to comment.