summaryrefslogtreecommitdiff
path: root/nest/a-set.c
diff options
context:
space:
mode:
authorOndrej Zajicek <santiago@crfreenet.org>2008-10-27 00:20:22 +0100
committerOndrej Zajicek <santiago@crfreenet.org>2008-10-27 00:20:22 +0100
commita98fbf0f12b5e83e25afa0f585ca6a4d4ac5f6bf (patch)
treef6c215cd05ec9278696fae7b8814b5071a4b3c6a /nest/a-set.c
parenta3b70dc499b64f41aa776b5b4afee5c7bfb8dfa6 (diff)
parent1567edea8d3da7da08092eef15bb3bd4544c6464 (diff)
Merge branch 'dev' into out
Diffstat (limited to 'nest/a-set.c')
-rw-r--r--nest/a-set.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/nest/a-set.c b/nest/a-set.c
index 44407141..69c090b7 100644
--- a/nest/a-set.c
+++ b/nest/a-set.c
@@ -40,10 +40,12 @@ int_set_format(struct adata *set, byte *buf, unsigned int size)
struct adata *
int_set_add(struct linpool *pool, struct adata *list, u32 val)
{
- struct adata *res = lp_alloc(pool, list->length + sizeof(struct adata) + 4);
- res->length = list->length+4;
+ int len = list ? list->length : 0;
+ struct adata *res = lp_alloc(pool, len + sizeof(struct adata) + 4);
+ res->length = len + 4;
* (u32 *) res->data = val;
- memcpy((char *) res->data + 4, list->data, list->length);
+ if (list)
+ memcpy((char *) res->data + 4, list->data, list->length);
return res;
}