Fix warnings, we may not always be dumping a object
[catagits/Catalyst-Runtime.git] / t / lib / TestApp / View / Dump.pm
index c4c29db..a59e417 100644 (file)
@@ -43,13 +43,17 @@ sub process {
         $c->res->headers->content_type('text/plain');
         $c->res->output($output);
 
-        # Repair context
-        $reference->{_context} = $context;
-        weaken( $reference->{_context} );
-
-        # Repair body
-        delete $reference->{__body_type};
-        $reference->{_body} = $body;
+        if ($context) {
+            # Repair context
+            $reference->{_context} = $context;
+            weaken( $reference->{_context} );
+        }
+
+        if ($body) {
+            # Repair body
+            delete $reference->{__body_type};
+            $reference->{_body} = $body;
+        }
 
         return 1;
     }