diff options
author | Linus Nordberg <linus@nordberg.se> | 2013-01-23 16:18:26 +0100 |
---|---|---|
committer | Linus Nordberg <linus@nordberg.se> | 2013-01-23 18:20:24 +0100 |
commit | 93894efe339664a9bf5ed19b13995bd3e8aabff7 (patch) | |
tree | 4e5cdbc2ad62429da3cfc4477884cbb25d9970ff /lib/conf.c | |
parent | 0e0b4ad17c5f41392f943a845933ccb51a9126c9 (diff) |
Handle case where config hasn't yet been read better.
Don't segfault is a good start.
Diffstat (limited to 'lib/conf.c')
-rw-r--r-- | lib/conf.c | 6 |
1 files changed, 4 insertions, 2 deletions
@@ -241,9 +241,11 @@ struct rs_realm * rs_conf_find_realm(struct rs_context *ctx, const char *name) { struct rs_realm *r; + assert (ctx); - for (r = ctx->config->realms; r; r = r->next) - if (strcmp (r->name, name) == 0) + if (ctx->config) + for (r = ctx->config->realms; r; r = r->next) + if (strcmp (r->name, name) == 0) return r; return NULL; |