diff --git a/src/mustach.c b/src/mustach.c index 9868cff..e2da8b2 100644 --- a/src/mustach.c +++ b/src/mustach.c @@ -38,7 +38,7 @@ static int getpartial(struct mustach_itf *itf, void *closure, const char *name, *result = NULL; file = open_memstream(result, &size); - if (file == NULL) + if (itf->put == NULL || file == NULL) rc = MUSTACH_ERROR_SYSTEM; else { rc = itf->put(closure, name, 0, file); @@ -192,6 +192,8 @@ static int process(const char *template, struct mustach_itf *itf, void *closure, default: /* replacement */ if (emit) { + if (itf->put == NULL) + return MUSTACH_ERROR_SYSTEM; rc = itf->put(closure, name, c != '&', file); if (rc < 0) return rc;