From cc9b21bd489a5ce4f018d382cab3b68608b21bf7 Mon Sep 17 00:00:00 2001 From: bnnm Date: Fri, 11 Nov 2016 23:36:12 +0100 Subject: [PATCH] Check if there are samples to play so it won't generate empty files --- src/vgmstream.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/vgmstream.c b/src/vgmstream.c index ecb41682..5c11754e 100644 --- a/src/vgmstream.c +++ b/src/vgmstream.c @@ -360,6 +360,13 @@ VGMSTREAM * init_vgmstream_internal(STREAMFILE *streamFile, int do_dfs) { if (vgmstream) { /* these are little hacky checks */ + /* fail if there is nothing to play + * (without this check vgmstream can generate empty files) */ + if ( vgmstream->num_samples==0 ) { + close_vgmstream(vgmstream); + continue; + } + /* everything should have a reasonable sample rate * (a verification of the metadata) */ if (!check_sample_rate(vgmstream->sample_rate)) {