aboutsummaryrefslogtreecommitdiffstats
path: root/Alc/helpers.c
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2014-08-10 09:12:08 -0700
committerChris Robinson <[email protected]>2014-08-10 09:12:08 -0700
commit936a79da7dccfe819b616c044c9d4930ef331d9e (patch)
tree9499d8722765f28da6d736fd33b5ad252f10c936 /Alc/helpers.c
parent94013216b62ff6f78c46fb67bf6d7b9dcbe1170f (diff)
Give NULL for null-vector iterators
Diffstat (limited to 'Alc/helpers.c')
-rw-r--r--Alc/helpers.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/Alc/helpers.c b/Alc/helpers.c
index 39a704fb..52fdf20a 100644
--- a/Alc/helpers.c
+++ b/Alc/helpers.c
@@ -644,7 +644,9 @@ ALboolean vector_insert(char *ptr, size_t base_size, size_t obj_size, void *ins_
vector_ *vecptr = (vector_*)ptr;
if(datstart != datend)
{
- ptrdiff_t ins_elem = ((char*)ins_pos - ((char*)(*vecptr) + base_size)) / obj_size;
+ ptrdiff_t ins_elem = (*vecptr ? ((char*)ins_pos - ((char*)(*vecptr) + base_size)) :
+ ((char*)ins_pos - (char*)NULL)) /
+ obj_size;
ptrdiff_t numins = ((const char*)datend - (const char*)datstart) / obj_size;
assert(numins > 0);