Fixed null pointer dereference with $upstream_cache_last_modified.
diff --git a/src/http/ngx_http_upstream.c b/src/http/ngx_http_upstream.c
index 9570ccc..c148f38 100644
--- a/src/http/ngx_http_upstream.c
+++ b/src/http/ngx_http_upstream.c
@@ -4555,7 +4555,8 @@
 {
     u_char  *p;
 
-    if (!r->upstream->conf->cache_revalidate
+    if (r->upstream == NULL
+        || !r->upstream->conf->cache_revalidate
         || r->upstream->cache_status != NGX_HTTP_CACHE_EXPIRED
         || r->cache->last_modified == -1)
     {