diff --git a/src/search/normal.c b/src/search/normal.c index a9b5b4792..2ede439da 100644 --- a/src/search/normal.c +++ b/src/search/normal.c @@ -119,7 +119,8 @@ mc_search__run_normal (mc_search_t * mc_search, const void *user_data, case COND__FOUND_CHAR_LAST: mc_search->normal_offset = current_pos; - *found_len = search_pos + 1; + if (found_len) + *found_len = search_pos + 1; return TRUE; break; diff --git a/src/search/regex.c b/src/search/regex.c index 83f83a2d9..70c05ae6f 100644 --- a/src/search/regex.c +++ b/src/search/regex.c @@ -453,7 +453,8 @@ mc_search__run_regex (mc_search_t * mc_search, const void *user_data, end_pos = mc_search->regex_match_info[0].rm_eo; #endif /* HAVE_LIBPCRE */ #endif /* GLIB_CHECK_VERSION (2, 14, 0) */ - *found_len = end_pos - start_pos; + if (found_len) + *found_len = end_pos - start_pos; mc_search->normal_offset = start_buffer + start_pos; return TRUE; break;