Fix cc_bookmarks

This commit is contained in:
Moritz Lipp 2011-10-12 12:49:52 +02:00
parent 094262c524
commit f384c912a0
2 changed files with 18 additions and 1 deletions

View file

@ -270,4 +270,3 @@ cmd_savef(girara_session_t* session, girara_list_t* argument_list)
return true;
}

View file

@ -154,6 +154,10 @@ cc_bookmarks(girara_session_t* session, const char* input)
girara_completion_t* completion = girara_completion_init();
girara_completion_group_t* group = girara_completion_group_create(session, NULL);
if (completion == NULL || group == NULL) {
goto error_free;
}
const size_t input_length = input ? strlen(input) : 0;
GIRARA_LIST_FOREACH(zathura->bookmarks.bookmarks, zathura_bookmark_t*, iter, bookmark)
@ -164,5 +168,19 @@ cc_bookmarks(girara_session_t* session, const char* input)
}
GIRARA_LIST_FOREACH_END(zathura->bookmarks.bookmarks, zathura_bookmark_t*, iter, bookmark)
girara_completion_add_group(completion, group);
return completion;
error_free:
if (completion) {
girara_completion_free(completion);
}
if (group) {
girara_completion_group_free(group);
}
return NULL;
}