some extra checks to avoid crashing
authorDragos Oancea <dragos.oancea@nexmo.com>
Mon, 24 Jul 2017 18:01:18 +0000 (19:01 +0100)
committerJean-Marc Valin <jmvalin@jmvalin.ca>
Tue, 25 Jul 2017 18:34:53 +0000 (14:34 -0400)
(modified by Jean-Marc Valin)

Signed-off-by: Jean-Marc Valin <jmvalin@jmvalin.ca>
src/opusenc.c

index 79ca1d8..2b8cf30 100644 (file)
@@ -368,7 +368,7 @@ fail:
 /* Create a new OggOpus stream, pulling one page at a time. */
 OPE_EXPORT OggOpusEnc *ope_encoder_create_pull(OggOpusComments *comments, opus_int32 rate, int channels, int family, int *error) {
   OggOpusEnc *enc = ope_encoder_create_callbacks(NULL, NULL, comments, rate, channels, family, error);
-  enc->pull_api = 1;
+  if (enc) enc->pull_api = 1;
   return enc;
 }