diff options
author | Linus Nordberg <linus@nordberg.se> | 2013-01-23 16:18:26 +0100 |
---|---|---|
committer | Linus Nordberg <linus@nordberg.se> | 2013-01-23 16:18:26 +0100 |
commit | d41b3758b160530490e124d84c32c1721da8d66b (patch) | |
tree | 4e5cdbc2ad62429da3cfc4477884cbb25d9970ff /lib | |
parent | 0e0b4ad17c5f41392f943a845933ccb51a9126c9 (diff) |
Handle case where config hasn't yet been read better.
Don't segfault is a good start.
Diffstat (limited to 'lib')
-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; |