gdesktopappinfo: Drop an unnecessary NULL check

`search_token` cannot be `NULL` at this point (guaranteed by all the
current call sites of `desktop_file_dir_unindexed_search()`), so remove
an unnecessary `NULL` check.

Add an assertion to make the nullability clear.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>

Coverity CID: #1502196, #1502193
This commit is contained in:
Philip Withnall 2022-12-29 15:57:53 +00:00
parent 0c640cf671
commit 8463155b21

View File

@ -1253,6 +1253,8 @@ desktop_file_dir_unindexed_search (DesktopFileDir *dir,
GHashTableIter iter;
gpointer key, value;
g_assert (search_token != NULL);
if (!dir->memory_index)
desktop_file_dir_unindexed_setup_search (dir);
@ -1270,7 +1272,7 @@ desktop_file_dir_unindexed_search (DesktopFileDir *dir,
p = strstr (key, search_token);
if (p == NULL)
continue;
else if (p == key && search_token != NULL && *search_token != '\0')
else if (p == key && *search_token != '\0')
match_type = MATCH_TYPE_PREFIX;
else
match_type = MATCH_TYPE_SUBSTRING;