Commit 02098331 authored by Brad Hards's avatar Brad Hards Committed by Rusty Russell

ccanlint: protect against the function element in the doc section being null

This can happen if the documentation doesn't have a properly formatted summary line,
and it causes the examples_relevant test to segfault.
parent 072d358f
...@@ -30,6 +30,11 @@ static void examples_relevant_check(struct manifest *m, ...@@ -30,6 +30,11 @@ static void examples_relevant_check(struct manifest *m,
if (!streq(d->type, "example")) if (!streq(d->type, "example"))
continue; continue;
if (!d->function) {
score_file_error(score, f, d->srcline+1,
"Function name not found in summary line");
continue;
}
for (i = 0; i < d->num_lines; i++) { for (i = 0; i < d->num_lines; i++) {
if (strstr(d->lines[i], d->function)) if (strstr(d->lines[i], d->function))
found = true; found = true;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment