From d56de37eb9a35c3db7f2e36892bd52d68ff0aef8 Mon Sep 17 00:00:00 2001 From: Andre Noll Date: Sat, 15 Sep 2007 09:50:14 +0200 Subject: [PATCH 1/1] Fix the privious assertion(). It's OK to ask for the name of an audio format id < 0, as id -1 is used for "currently no audio file is open". So allow this case, and fix the upper bound which was off by one while we're at it. --- vss.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/vss.c b/vss.c index 98ad11f6..3ba5994b 100644 --- a/vss.c +++ b/vss.c @@ -153,8 +153,9 @@ unsigned int vss_paused(void) */ const char *audio_format_name(int i) { - assert(i >= 0 && i < ARRAY_SIZE(afl)); - return afl[i].name; + //PARA_NOTICE_LOG("array size: %u¸ requested: %d\n", ARRAY_SIZE(afl), i); + assert(i < 0 || i < ARRAY_SIZE(afl) - 1); + return i >= 0? afl[i].name : "(none)"; } /** -- 2.39.2