]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
Make sure we protect ourselves against the session being NULL, which it will be
authorGraham Leggett <minfrin@apache.org>
Sat, 5 Apr 2008 15:05:15 +0000 (15:05 +0000)
committerGraham Leggett <minfrin@apache.org>
Sat, 5 Apr 2008 15:05:15 +0000 (15:05 +0000)
if no session is configured.

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@645112 13f79535-47bb-0310-9956-ffa450edef68

modules/session/mod_session.c

index 7e7867a389ba22e638256d8bba651a356862e243..59ea50eaf3e35bb0f0cf503c50f4974b338c7dd8 100644 (file)
@@ -92,7 +92,9 @@ AP_DECLARE(void) ap_session_get(request_rec * r, session_rec * z, const char *ke
     if (!z) {
         ap_session_load(r, &z);
     }
-    *value = apr_table_get(z->entries, key);
+    if (z) {
+        *value = apr_table_get(z->entries, key);
+    }
 }
 
 /**
@@ -113,13 +115,15 @@ AP_DECLARE(void) ap_session_set(request_rec * r, session_rec * z,
     if (!z) {
         ap_session_load(r, &z);
     }
-    if (value) {
-        apr_table_set(z->entries, key, value);
-    }
-    else {
-        apr_table_unset(z->entries, key);
+    if (z) {
+        if (value) {
+            apr_table_set(z->entries, key, value);
+        }
+        else {
+            apr_table_unset(z->entries, key);
+        }
+        z->dirty = 1;
     }
-    z->dirty = 1;
 }
 
 /**