diff options
author | Graham Leggett <minfrin@apache.org> | 2008-04-05 17:05:15 +0200 |
---|---|---|
committer | Graham Leggett <minfrin@apache.org> | 2008-04-05 17:05:15 +0200 |
commit | f10397f26cc8372ffc16bde536429d4c29c6acba (patch) | |
tree | 93bd639479de5acc0d9e952e1fbc00ade7218437 /modules/session | |
parent | updates docco xform (diff) | |
download | apache2-f10397f26cc8372ffc16bde536429d4c29c6acba.tar.xz apache2-f10397f26cc8372ffc16bde536429d4c29c6acba.zip |
Make sure we protect ourselves against the session being NULL, which it will be
if no session is configured.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@645112 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'modules/session')
-rw-r--r-- | modules/session/mod_session.c | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/modules/session/mod_session.c b/modules/session/mod_session.c index 7e7867a389..59ea50eaf3 100644 --- a/modules/session/mod_session.c +++ b/modules/session/mod_session.c @@ -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; } /** |