From 424d1b5fab3d4ae806414915bade1dae55c2530b Mon Sep 17 00:00:00 2001 From: Hugo Locurcio Date: Sun, 31 May 2020 19:10:27 +0200 Subject: [PATCH] Print errors when calling MIDI input methods on unsupported platforms This partially addresses #32065. (cherry picked from commit 9c0d21477617f8bbf771c26787ca5e13d4b29a8a) --- core/os/os.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/core/os/os.cpp b/core/os/os.cpp index be1c93ea007..633433e79ca 100644 --- a/core/os/os.cpp +++ b/core/os/os.cpp @@ -728,19 +728,25 @@ PoolStringArray OS::get_connected_midi_inputs() { return MIDIDriver::get_singleton()->get_connected_inputs(); PoolStringArray list; - return list; + ERR_FAIL_V_MSG(list, vformat("MIDI input isn't supported on %s.", OS::get_singleton()->get_name())); } void OS::open_midi_inputs() { - if (MIDIDriver::get_singleton()) + if (MIDIDriver::get_singleton()) { MIDIDriver::get_singleton()->open(); + } else { + ERR_PRINT(vformat("MIDI input isn't supported on %s.", OS::get_singleton()->get_name())); + } } void OS::close_midi_inputs() { - if (MIDIDriver::get_singleton()) + if (MIDIDriver::get_singleton()) { MIDIDriver::get_singleton()->close(); + } else { + ERR_PRINT(vformat("MIDI input isn't supported on %s.", OS::get_singleton()->get_name())); + } } OS::OS() {