diff --git a/cli/vgmstream_cli.c b/cli/vgmstream_cli.c index 9e785f99..6ca4d8b4 100644 --- a/cli/vgmstream_cli.c +++ b/cli/vgmstream_cli.c @@ -433,8 +433,11 @@ int main(int argc, char ** argv) { /* prints done */ if (cfg.print_metaonly) { - if (!cfg.play_sdtout) - fclose(outfile); + if (!cfg.play_sdtout) { + if(outfile != NULL) { + fclose(outfile); + } + } close_vgmstream(vgmstream); return EXIT_SUCCESS; }