diff options
author | QC <qball@gmpclient.org> | 2014-08-29 12:14:43 +0200 |
---|---|---|
committer | QC <qball@gmpclient.org> | 2014-08-29 12:14:43 +0200 |
commit | 169c05cc1529d3165aaa5d14a41e45db6a75b48a (patch) | |
tree | efc538ebef6a309e83caa63ab224616136d477c1 /source/history.c | |
parent | 5b017b017b1dfb6d15c70579246b2ffa9aaea763 (diff) |
Fix crash in history when removing last entry.
Diffstat (limited to 'source/history.c')
-rw-r--r-- | source/history.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/source/history.c b/source/history.c index 779f6e1b..1d1ffd7f 100644 --- a/source/history.c +++ b/source/history.c @@ -52,7 +52,7 @@ static int __element_sort_func ( const void *ea, const void *eb ) static void __history_write_element_list ( FILE *fd, _element **list, unsigned int length ) { - if ( list == NULL ) { + if ( list == NULL || length == 0 ) { return; } // Sort the list before writing out. @@ -235,6 +235,8 @@ void history_remove ( const char *filename, const char *entry ) char ** history_get_list ( const char *filename, unsigned int *length ) { + *length = 0; + if ( config.disable_history ) { return NULL; } |