Avoid corrupting an (invalid) FLAC Ogg file without Vorbis comment

FLAC in Ogg must have a Vorbis comment Metadata block, but in case
the file still has none avoid overwriting the first packet, i.e.
the Streaminfo Metadata block.
This commit is contained in:
Stefan Brüns
2026-01-13 00:35:15 +01:00
committed by Urs Fleisch
parent 70c6a0c75f
commit b4a4b42254

View File

@ -107,6 +107,11 @@ Properties *Ogg::FLAC::File::audioProperties() const
bool Ogg::FLAC::File::save()
{
if (d->commentPacket == 0) {
debug("Ogg::FLAC::File::save() -- Invalid, file has no Vorbis comment metadata block.");
return false;
}
d->xiphCommentData = d->comment->render(false);
// Create FLAC metadata-block: