Check for mode creation failure before we try to use it.
authorTimothy B. Terriberry <tterribe@xiph.org>
Thu, 3 Feb 2011 23:32:06 +0000 (15:32 -0800)
committerJean-Marc Valin <jean-marc.valin@usherbrooke.ca>
Fri, 4 Feb 2011 03:43:53 +0000 (22:43 -0500)
Not after.

libcelt/testcelt.c

index ca89c1e..d32786d 100644 (file)
@@ -76,14 +76,13 @@ int main(int argc, char *argv[])
    channels = atoi(argv[2]);
    frame_size = atoi(argv[3]);
    mode = celt_mode_create(rate, frame_size, NULL);
-   celt_mode_info(mode, CELT_GET_LOOKAHEAD, &skip);
-   
    if (mode == NULL)
    {
       fprintf(stderr, "failed to create a mode\n");
       return 1;
    }
-   
+
+   celt_mode_info(mode, CELT_GET_LOOKAHEAD, &skip);
    bytes_per_packet = atoi(argv[4]);
    if (bytes_per_packet < 0 || bytes_per_packet > MAX_PACKET)
    {