summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorLinus Nordberg <linus@nordberg.se>2013-01-23 16:18:26 +0100
committerLinus Nordberg <linus@nordberg.se>2013-01-23 16:18:26 +0100
commitd41b3758b160530490e124d84c32c1721da8d66b (patch)
tree4e5cdbc2ad62429da3cfc4477884cbb25d9970ff /lib
parent0e0b4ad17c5f41392f943a845933ccb51a9126c9 (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.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/conf.c b/lib/conf.c
index 14b7579..8ad0a45 100644
--- a/lib/conf.c
+++ b/lib/conf.c
@@ -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;