index : pacman | |
Archlinux32 fork of pacman | gitolite user |
summaryrefslogtreecommitdiff |
author | Dan McGee <dan@archlinux.org> | 2008-02-24 01:17:17 -0600 |
---|---|---|
committer | Dan McGee <dan@archlinux.org> | 2008-02-24 01:17:17 -0600 |
commit | 96f7613d15e46131bf8a4b93828ad70b041524d1 (patch) | |
tree | f65e1b56d32519fa8c85e8339746f3a5b5e9d37b /src | |
parent | 105e01c8efcb3a27cb55cc5dd7bf15afbea80698 (diff) |
-rw-r--r-- | src/pacman/callback.c | 2 | ||||
-rw-r--r-- | src/pacman/util.c | 23 |
diff --git a/src/pacman/callback.c b/src/pacman/callback.c index 629c2e1c..01e65a95 100644 --- a/src/pacman/callback.c +++ b/src/pacman/callback.c @@ -592,7 +592,7 @@ void cb_dl_progress(const char *filename, int file_xfered, int file_total, /* Callback to handle notifications from the library */ void cb_log(pmloglevel_t level, char *fmt, va_list args) { - if(strlen(fmt) == 0) { + if(!fmt || strlen(fmt) == 0) { return; } diff --git a/src/pacman/util.c b/src/pacman/util.c index 42436e26..aa08eb26 100644 --- a/src/pacman/util.c +++ b/src/pacman/util.c @@ -224,6 +224,10 @@ void indentprint(const char *str, int indent) const wchar_t *p; int len, cidx; + if(!str) { + return; + } + len = strlen(str) + 1; wcstr = calloc(len, sizeof(wchar_t)); len = mbstowcs(wcstr, str, len); @@ -401,14 +405,17 @@ void list_display(const char *title, const alpm_list_t *list) int cols, len; wchar_t *wcstr; - /* len goes from # bytes -> # chars -> # cols */ - len = strlen(title) + 1; - wcstr = calloc(len, sizeof(wchar_t)); - len = mbstowcs(wcstr, title, len); - len = wcswidth(wcstr, len); - free(wcstr); - - printf("%s ", title); + if(title) { + /* len goes from # bytes -> # chars -> # cols */ + len = strlen(title) + 1; + wcstr = calloc(len, sizeof(wchar_t)); + len = mbstowcs(wcstr, title, len); + len = wcswidth(wcstr, len); + free(wcstr); + printf("%s ", title); + } else { + len = 0; + } if(list) { for(i = list, cols = len; i; i = alpm_list_next(i)) { |