fix segfault
diff --git a/src/http/modules/perl/nginx.xs b/src/http/modules/perl/nginx.xs
index 558922c..1c78eab 100644
--- a/src/http/modules/perl/nginx.xs
+++ b/src/http/modules/perl/nginx.xs
@@ -387,7 +387,10 @@
 
     ngx_http_perl_set_request(r);
 
-    if (r->request_body->temp_file || r->request_body->bufs == NULL) {
+    if (r->request_body == NULL
+        || r->request_body->temp_file
+        || r->request_body->bufs == NULL)
+    {
         XSRETURN_UNDEF;
     }
 
@@ -411,7 +414,7 @@
 
     ngx_http_perl_set_request(r);
 
-    if (r->request_body->temp_file == NULL) {
+    if (r->request_body == NULL || r->request_body->temp_file == NULL) {
         XSRETURN_UNDEF;
     }