From 020983311c9f58bee8d528f80c7c097c4405975c Mon Sep 17 00:00:00 2001 From: Brad Hards Date: Wed, 19 Jan 2011 17:03:32 +1100 Subject: [PATCH] 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. --- tools/ccanlint/tests/examples_relevant.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tools/ccanlint/tests/examples_relevant.c b/tools/ccanlint/tests/examples_relevant.c index 283e78c1..66dee27e 100644 --- a/tools/ccanlint/tests/examples_relevant.c +++ b/tools/ccanlint/tests/examples_relevant.c @@ -30,6 +30,11 @@ static void examples_relevant_check(struct manifest *m, if (!streq(d->type, "example")) 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++) { if (strstr(d->lines[i], d->function)) found = true; -- 2.39.2