diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2016-09-28 14:42:24 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2016-09-28 14:42:24 +0100 |
commit | badeba0ee1c97acabf25f8e33ba07ce96fac3298 (patch) | |
tree | f11392707c533dc94a7ea13aab51a067989ebe32 /src/libutil/util.h | |
parent | 388c08c712c8279a52ad82caa213191352639ca9 (diff) | |
download | rspamd-badeba0ee1c97acabf25f8e33ba07ce96fac3298.tar.gz rspamd-badeba0ee1c97acabf25f8e33ba07ce96fac3298.zip |
[Minor] Do not crash with empty array
Diffstat (limited to 'src/libutil/util.h')
-rw-r--r-- | src/libutil/util.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/libutil/util.h b/src/libutil/util.h index 1f2d2f852..85d2ce242 100644 --- a/src/libutil/util.h +++ b/src/libutil/util.h @@ -500,5 +500,5 @@ gpointer rspamd_file_xmap (const char *fname, guint mode, gpointer rspamd_shmem_xmap (const char *fname, guint mode, gsize *size); -#define PTR_ARRAY_FOREACH(ar, i, cur) for ((i) = 0, (cur) = g_ptr_array_index((ar), 0); (i) < (ar)->len; (cur) = g_ptr_array_index((ar), (i)), ++(i)) +#define PTR_ARRAY_FOREACH(ar, i, cur) if (ar != NULL) for ((i) = 0, (cur) = g_ptr_array_index((ar), 0); (i) < (ar)->len; (cur) = g_ptr_array_index((ar), (i)), ++(i)) #endif |