eina_array: interpret the count of a NULL array as 0
authorMarcel Hollerbach <mail@marcel-hollerbach.de>
Mon, 17 Feb 2020 12:55:33 +0000 (13:55 +0100)
committerJongmin Lee <jm105.lee@samsung.com>
Wed, 19 Feb 2020 20:52:13 +0000 (05:52 +0900)
this makes the usage way more convinient.

Reviewed-by: Xavi Artigas <xavierartigas@yahoo.es>
Differential Revision: https://phab.enlightenment.org/D11373

src/lib/eina/eina_inline_array.x

index d750782ce805f30f9f2c8002b379312127af5b23..8367d61e7be01acd28213ba3e678e6d2817694f2 100644 (file)
@@ -89,6 +89,7 @@ eina_array_count_get(const Eina_Array *array)
 static inline unsigned int
 eina_array_count(const Eina_Array *array)
 {
+   if (!array) return 0;
    return array->count;
 }