summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorVito Caputo <vcaputo@pengaru.com>2023-06-08 19:36:12 -0700
committerVito Caputo <vcaputo@pengaru.com>2023-06-08 19:36:12 -0700
commit7b09ed69ad9f454e702b750d529a8dda95de0aec (patch)
tree593b78f5121fae12f560c2c4354c740d6ebfd888 /src
parent57aa42fe84b5922c32cae89b2b9e63deb7726cc7 (diff)
modules/rkt: detect errors when creating scene contexts
The return value was just being ignored previously, and that really starts mattering in a world with contexts finding others by user-supplied paths making such failures far more likely.
Diffstat (limited to 'src')
-rw-r--r--src/modules/rkt/rkt.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/modules/rkt/rkt.c b/src/modules/rkt/rkt.c
index 42f51e7..755074b 100644
--- a/src/modules/rkt/rkt.c
+++ b/src/modules/rkt/rkt.c
@@ -104,13 +104,17 @@ static til_module_context_t * rkt_create_context(const til_module_t *module, til
for (size_t i = 0; i < s->n_scenes; i++) {
til_setup_t *module_setup = NULL;
+ int r;
+ /* FIXME TODO: this needs to be handle-aware so scenes can directly reference existing contexts */
ctxt->scenes[i].module = til_lookup_module(s->scenes[i].module_name);
if (!ctxt->scenes[i].module) /* this isn't really expected since setup already does this */
return til_module_context_free(&ctxt->til_module_context);
- (void) til_module_create_context(ctxt->scenes[i].module, stream, rand_r(&seed), ticks, 0, s->scenes[i].setup, &ctxt->scenes[i].module_ctxt);
+ r = til_module_create_context(ctxt->scenes[i].module, stream, rand_r(&seed), ticks, 0, s->scenes[i].setup, &ctxt->scenes[i].module_ctxt);
til_setup_free(module_setup);
+ if (r < 0)
+ return til_module_context_free(&ctxt->til_module_context);
}
ctxt->rows_per_ms = s->rows_per_ms;
© All Rights Reserved