]> git.tuebingen.mpg.de Git - paraslash.git/commitdiff
Replace assertion for invalid audio formats by a runtime check.
authorAndre Noll <maan@systemlinux.org>
Fri, 6 Nov 2009 14:07:18 +0000 (15:07 +0100)
committerAndre Noll <maan@systemlinux.org>
Fri, 6 Nov 2009 14:16:24 +0000 (15:16 +0100)
In case one switches back and forth between different versions of
para_server that support different audio formats, it may happen
that the aft table contains entries for audio formats that are not
supported by the version currently running.

ATM, this causes para_server to die immediately because of the
assertion in audio_format_name. Replace the assertion by a less
draconian run time check that returns the string "???" if the number
for an unknown audio file format is being looked up.

afh_common.c

index 8c0eed2731837da4e8d3847d1d3d6caeddfe5102..7d4ab08952dbb259075b96f73e228f81da7db8e9 100644 (file)
@@ -208,9 +208,9 @@ int compute_afhi(const char *path, char *data, size_t size, int fd,
  */
 const char *audio_format_name(int i)
 {
-       //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)";
+       if (i < 0 || i >= ARRAY_SIZE(afl) - 1)
+               return "???";
+       return afl[i].name;
 }
 
 /**