From 31c015c68051b7ca612bc41f1a7bff387cdd3df2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Ekl=C3=B6f?= Date: Mon, 2 Nov 2020 19:57:31 +0100 Subject: [PATCH] particle/ramp: handle tag_for_name() failing --- particles/ramp.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/particles/ramp.c b/particles/ramp.c index db63aff..45cc277 100644 --- a/particles/ramp.c +++ b/particles/ramp.c @@ -95,13 +95,12 @@ instantiate(const struct particle *particle, const struct tag_set *tags) { const struct private *p = particle->private; const struct tag *tag = tag_for_name(tags, p->tag); - assert(tag != NULL); assert(p->count > 0); - long value = tag->as_int(tag); - long min = tag->min(tag); - long max = tag->max(tag); + long value = tag != NULL ? tag->as_int(tag) : 0; + long min = tag != NULL ? tag->min(tag) : 0; + long max = tag != NULL ? tag->max(tag) : 0; assert(value >= min && value <= max); assert(max >= min);