particle/ramp: handle tag_for_name() failing

This commit is contained in:
Daniel Eklöf 2020-11-02 19:57:31 +01:00
parent 05aa44f1ab
commit 31c015c680
No known key found for this signature in database
GPG key ID: 5BBD4992C116573F

View file

@ -95,13 +95,12 @@ instantiate(const struct particle *particle, const struct tag_set *tags)
{ {
const struct private *p = particle->private; const struct private *p = particle->private;
const struct tag *tag = tag_for_name(tags, p->tag); const struct tag *tag = tag_for_name(tags, p->tag);
assert(tag != NULL);
assert(p->count > 0); assert(p->count > 0);
long value = tag->as_int(tag); long value = tag != NULL ? tag->as_int(tag) : 0;
long min = tag->min(tag); long min = tag != NULL ? tag->min(tag) : 0;
long max = tag->max(tag); long max = tag != NULL ? tag->max(tag) : 0;
assert(value >= min && value <= max); assert(value >= min && value <= max);
assert(max >= min); assert(max >= min);