MINOR: vars: make get_vars() allow the session to be null
authorWilly Tarreau <w@1wt.eu>
Fri, 26 Mar 2021 10:27:59 +0000 (11:27 +0100)
committerWilly Tarreau <w@1wt.eu>
Fri, 26 Mar 2021 15:23:45 +0000 (16:23 +0100)
In order to support manipulating variables from outside a session,
let's make get_vars() not assume that the session is always set.

src/vars.c

index 3390d24..3c19ec8 100644 (file)
@@ -47,7 +47,7 @@ static inline struct vars *get_vars(struct session *sess, struct stream *strm, e
        case SCOPE_PROC:
                return &global.vars;
        case SCOPE_SESS:
-               return &sess->vars;
+               return sess ? &sess->vars : NULL;
        case SCOPE_CHECK: {
                        struct check *check = objt_check(sess->origin);