Fix crash when user menu is called in editor with no filename.

(mc_search): immediately return FALSE if str is NULL.
(mc_search_run): immediately return FALSE if user_data is NULL.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
This commit is contained in:
Andrew Borodin 2012-12-07 12:56:59 +04:00
parent 2eeb950439
commit e574972d58
1 changed files with 9 additions and 3 deletions

View File

@ -238,7 +238,7 @@ mc_search_run (mc_search_t * lc_mc_search, const void *user_data,
{
gboolean ret = FALSE;
if (!lc_mc_search)
if (lc_mc_search == NULL || user_data == NULL)
return FALSE;
if (!mc_search_is_type_avail (lc_mc_search->search_type))
{
@ -382,9 +382,15 @@ gboolean
mc_search (const gchar * pattern, const gchar * str, mc_search_type_t type)
{
gboolean ret;
mc_search_t *search = mc_search_new (pattern, -1);
if (search == NULL)
mc_search_t *search;
if (str == NULL)
return FALSE;
search = mc_search_new (pattern, -1);
if (search == NULL )
return FALSE;
search->search_type = type;
search->is_case_sensitive = TRUE;