libFLAC: Fix decoder_flush with uninitialized decoder
[flac.git] / src / libFLAC / stream_decoder.c
index 231422c..04ce7cd 100644 (file)
@@ -936,6 +936,9 @@ FLAC_API FLAC__bool FLAC__stream_decoder_flush(FLAC__StreamDecoder *decoder)
        FLAC__ASSERT(0 != decoder->private_);
        FLAC__ASSERT(0 != decoder->protected_);
 
+       if(!decoder->private_->internal_reset_hack && decoder->protected_->state == FLAC__STREAM_DECODER_UNINITIALIZED)
+               return false;
+
        decoder->private_->samples_decoded = 0;
        decoder->private_->do_md5_checking = false;