Bläddra i källkod

libobs/util: Fix incorrect assertion in darray_insert_array

Previously the assertion required the idx to be smaller than the number
of elements in the darray. This would mean you could not insert anything
at the end of a darray, and would make it impossible to insert an array
into an empty darray.
VodBox 5 år sedan
förälder
incheckning
d1b6a04afc
1 ändrade filer med 1 tillägg och 1 borttagningar
  1. 1 1
      libobs/util/darray.h

+ 1 - 1
libobs/util/darray.h

@@ -284,7 +284,7 @@ static inline void darray_insert_array(const size_t element_size,
 
 	assert(array != NULL);
 	assert(num != 0);
-	assert(idx < dst->num);
+	assert(idx <= dst->num);
 
 	old_num = dst->num;
 	darray_resize(element_size, dst, dst->num + num);