Fix undef warning in Engine::FastCGI
Tomas Doran [Thu, 27 Jan 2011 11:01:41 +0000 (11:01 +0000)]
Changes
lib/Catalyst/Engine/FastCGI.pm

diff --git a/Changes b/Changes
index d026586..7bd048f 100644 (file)
--- a/Changes
+++ b/Changes
@@ -7,6 +7,9 @@
     which results in new Package::Stash, then it can leave you with a broken
     version of MooseX::Role::WithOverloading.
 
+  - Fix undef warning in Catalyst::Engine::FastCGI when writing an empty
+    body (e.g. doing a redirect)
+
 5.80030 2011-01-04 13:13:02
 
  New features:
index 67b79be..30bb3a5 100644 (file)
@@ -159,6 +159,10 @@ sub run {
 sub write {
     my ( $self, $c, $buffer ) = @_;
 
+    # ->write will be called once with the body, even in a redirect (and
+    # in that case, the body is undef)
+    $buffer = '' if !defined $buffer;
+
     unless ( $self->_prepared_write ) {
         $self->prepare_write($c);
         $self->_prepared_write(1);