From 65f78869fafdc01c7248d327d47bbe7804862a53 Mon Sep 17 00:00:00 2001 From: Paul Brossier Date: Fri, 10 May 2019 09:53:24 +0200 Subject: [PATCH] [effects] remove asserts from aubio_split_str --- src/effects/rubberband_utils.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/effects/rubberband_utils.c b/src/effects/rubberband_utils.c index b48670a7..6e904c41 100644 --- a/src/effects/rubberband_utils.c +++ b/src/effects/rubberband_utils.c @@ -17,7 +17,6 @@ #include #include #include -#include char_t** aubio_split_str(const char_t* str, const char_t sep) { char_t** result = 0; @@ -44,17 +43,18 @@ char_t** aubio_split_str(const char_t* str, const char_t sep) { result = AUBIO_ARRAY(char_t*, count); if (result) { - uint_t idx = 0; + uint_t idx = 0; char_t* params = strtok(input, delim); while (params) { // make sure we don't got in the wild - assert(idx < count); + if (idx >= count) + break; *(result + idx++) = strdup(params); params = strtok(0, delim); } - assert(idx == count - 1); - // add null string at the end - *(result + idx) = 0; + // add null string at the end if needed + if (idx < count - 1) + *(result + idx) = 0; } return result; } -- 2.11.0