FLAC__stream_encoder_finish: Sanity improvement

Previously this function would abort or crash if passed `NULL` for
the encoder. Now it just returns without crashing or aborting which
is far more sane behaviour (ie much like FLAC__stream_encoder_delete).
This commit is contained in:
Erik de Castro Lopo 2017-01-31 06:39:22 +11:00
parent 33f093ae2f
commit 006dcfbe23

View File

@ -1439,7 +1439,9 @@ FLAC_API FLAC__bool FLAC__stream_encoder_finish(FLAC__StreamEncoder *encoder)
{ {
FLAC__bool error = false; FLAC__bool error = false;
FLAC__ASSERT(0 != encoder); if (encoder == NULL)
return false;
FLAC__ASSERT(0 != encoder->private_); FLAC__ASSERT(0 != encoder->private_);
FLAC__ASSERT(0 != encoder->protected_); FLAC__ASSERT(0 != encoder->protected_);