From 48e65c011d5debe8f50dd65468ac1c0134b5b232 Mon Sep 17 00:00:00 2001 From: Timo Sirainen Date: Tue, 24 Mar 2020 12:24:01 +0200 Subject: [PATCH] stats, fts-solr: Tweak unit tests to make static analyzers happier --- src/plugins/fts-solr/test-solr-response.c | 2 +- src/stats/test-stats-metrics.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/plugins/fts-solr/test-solr-response.c b/src/plugins/fts-solr/test-solr-response.c index 6ddeb48c3c..8add6db144 100644 --- a/src/plugins/fts-solr/test-solr-response.c +++ b/src/plugins/fts-solr/test-solr-response.c @@ -156,7 +156,7 @@ test_solr_result(const struct solr_response_test_result *test_results, if (test_has_failed()) return; - for (i = 0; i < rcount; i++) { + for (i = 0; i < rcount && parse_results[i] != NULL; i++) { unsigned int scount, j; const struct fts_score_map *tscores = test_results[i].scores; const struct fts_score_map *pscores = diff --git a/src/stats/test-stats-metrics.c b/src/stats/test-stats-metrics.c index 380c49b229..c255b77333 100644 --- a/src/stats/test-stats-metrics.c +++ b/src/stats/test-stats-metrics.c @@ -117,7 +117,7 @@ static void test_stats_metrics_group_by_check_one(const struct metric *metric, if (group_by_count > 0) { test_assert(metric->group_by_count == group_by_count); - test_assert(metric->group_by != NULL); + i_assert(metric->group_by != NULL); test_assert(metric->group_by[0].func == group_by_func); test_assert_strcmp(metric->group_by[0].field, group_by_field); } else { -- 2.47.3