diff options
-rw-r--r-- | libq/atom.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/libq/atom.c b/libq/atom.c index 31299f1..b1a150a 100644 --- a/libq/atom.c +++ b/libq/atom.c @@ -1252,7 +1252,15 @@ atom_compar_cb(const void *l, const void *r) default: { int ret; - ret = strcmp(al->CATEGORY, ar->CATEGORY); + if (!al->CATEGORY && !ar->CATEGORY) { + ret = 0; + } else if (!al->CATEGORY) { + ret = -1; + } else if (!ar->CATEGORY) { + ret = 1; + } else { + ret = strcmp(al->CATEGORY, ar->CATEGORY); + } if (ret == 0) ret = strcasecmp(al->PN, ar->PN); return ret; |