diff options
author | Brad Hards <bradh@frogmouth.net> | 2011-01-19 17:03:32 +1100 |
---|---|---|
committer | Rusty Russell <rusty@rustcorp.com.au> | 2011-01-22 12:34:27 +1030 |
commit | 020983311c9f58bee8d528f80c7c097c4405975c (patch) | |
tree | cce2e7503f60069b7cda7b0824046c844c8d7049 | |
parent | 072d358f47ba33b8d6d388fcaf219dc152f79b5d (diff) |
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.
-rw-r--r-- | tools/ccanlint/tests/examples_relevant.c | 5 |
1 files changed, 5 insertions, 0 deletions
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; |