Additional checks to keep zero-length messages from crashing the indexer.
[citadel.git] / libcitadel / lib / array.c
index b30e9ebf209add27aeea65760844064e6eee64ed..e6d26aa231670fcdd6a7c12ef2193b84619a0363 100644 (file)
@@ -68,6 +68,10 @@ void *array_get_element_at(Array *arr, int index) {
 
 // Return the number of elements in an array
 int array_len(Array *arr) {
+       if (!arr) {
+               return(0);
+       }
+
        return arr->num_elements;
 }