Skip to content
Browse files

check whether request config is set or not.

  • Loading branch information...
1 parent a37812c commit 56e4859bca45fcd4edf1a5e663fd46eebf4f8e78 shugo committed Mar 4, 2006
Showing with 6 additions and 4 deletions.
  1. +3 −2 mod_ruby.c
  2. +3 −2 request.c
View
5 mod_ruby.c
@@ -526,7 +526,7 @@ static void handle_error(request_rec *r, int state)
errmsg = ruby_get_error_info(state);
if (r->request_config) {
rconf = get_request_config(r);
- if (!NIL_P(rconf->request_object))
+ if (rconf && !NIL_P(rconf->request_object))
rb_apache_request_set_error(rconf->request_object,
errmsg, ruby_errinfo);
}
@@ -1173,7 +1173,8 @@ static void per_request_cleanup(request_rec *r, int flush)
rb_set_kcode(default_kcode);
if (r->request_config) {
ruby_request_config *rconf = get_request_config(r);
- restore_env(r->pool, rconf->saved_env);
+ if (rconf)
+ restore_env(r->pool, rconf->saved_env);
}
rb_progname = Qnil;
if (dconf->gc_per_request)
View
5 request.c
@@ -205,7 +205,8 @@ static VALUE apache_request_new(request_rec *r)
rb_apache_register_object(obj);
if (r->request_config) {
ruby_request_config *rconf = get_request_config(r);
- rconf->request_object = obj;
+ if (rconf)
+ rconf->request_object = obj;
}
apr_pool_cleanup_register(r->pool, (void *) r,
cleanup_request_object, apr_pool_cleanup_null);
@@ -231,7 +232,7 @@ VALUE rb_get_request_object(request_rec *r)
if (r == NULL) return Qnil;
if (r->request_config) {
ruby_request_config *rconf = get_request_config(r);
- if (!NIL_P(rconf->request_object))
+ if (rconf && !NIL_P(rconf->request_object))
return rconf->request_object;
}
return apache_request_new(r);

0 comments on commit 56e4859

Please sign in to comment.
Something went wrong with that request. Please try again.