From 5b3b6ab3cb9578e680148d822b4df309166261a6 Mon Sep 17 00:00:00 2001 From: kevin Date: Sat, 1 Oct 2022 19:00:33 -0400 Subject: [PATCH] cwIoMidiRecordPlay.cpp : am_to_midi_file() verify file exists. --- cwIoMidiRecordPlay.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/cwIoMidiRecordPlay.cpp b/cwIoMidiRecordPlay.cpp index 2b395fc..780c3f9 100644 --- a/cwIoMidiRecordPlay.cpp +++ b/cwIoMidiRecordPlay.cpp @@ -1333,6 +1333,12 @@ cw::rc_t cw::midi_record_play::am_to_midi_file( const char* am_filename, const c unsigned msgArrayCnt = 0; am_midi_msg_t* msgArray = nullptr; + if(!filesys::isFile(am_filename)) + { + cwLogError(kOpenFailRC,"The AM file '%s' does not exist.",am_filename); + goto errLabel; + } + if((rc = _am_file_read( am_filename, msgArrayCnt, msgArray )) != kOkRC ) { rc = cwLogError(rc,"Unable to read AM file '%s'.", cwStringNullGuard(am_filename));