]> granicus.if.org Git - php/commitdiff
It makes more sense to do the null-pointer check *before* trying to use it.
authorAaron Bannert <aaron@php.net>
Thu, 18 Apr 2002 16:25:50 +0000 (16:25 +0000)
committerAaron Bannert <aaron@php.net>
Thu, 18 Apr 2002 16:25:50 +0000 (16:25 +0000)
(Also fix a typo that Cliff pointed out: "safe" --> "save".)

Obtained from:  Ryan Morgan <rmorgan@covalent.net>

sapi/apache2filter/sapi_apache2.c

index 24724bb9b7eed023a3fdc3d3cbc67125539b680a..856d146c3452737f81fcef7d6de274bf76a7a146 100644 (file)
@@ -346,12 +346,12 @@ static int php_output_filter(ap_filter_t *f, apr_bucket_brigade *bb)
        ap_add_cgi_vars(f->r);
 
        ctx = SG(server_context);
-       ctx->f = f; /* safe whatever filters are after us in the chain. */
        if (ctx == NULL) {
                ap_log_rerror(APLOG_MARK, APLOG_ERR|APLOG_NOERRNO, 0, f->r,
                                         "php failed to get server context");
         return HTTP_INTERNAL_SERVER_ERROR;
        }
+       ctx->f = f; /* save whatever filters are after us in the chain. */
 
        if (ctx->request_processed) {
                return ap_pass_brigade(f->next, bb);