- fixed crash during enumeration of MIDI devices

libraries/zmusic/zmusic/configuration.cpp:109:9: warning: returning reference to local temporary object [-Wreturn-stack-address]
This commit is contained in:
alexey.lysiuk 2020-01-02 13:08:10 +02:00
parent ea1b8de405
commit f2bacd5faf

View file

@ -97,17 +97,13 @@ int ZMusic_EnumerateMidiDevices()
const std::vector<MidiOutDevice> &ZMusic_GetMidiDevices() const std::vector<MidiOutDevice> &ZMusic_GetMidiDevices()
{ {
#ifdef HAVE_SYSTEM_MIDI #if defined HAVE_SYSTEM_MIDI && defined __linux__
#ifdef __linux__ auto &sequencer = AlsaSequencer::Get();
auto & sequencer = AlsaSequencer::Get(); return sequencer.GetDevices();
return sequencer.GetDevices(); #else // !HAVE_SYSTEM_MIDI || !__linux__
#elif _WIN32 static std::vector<MidiOutDevice> empty;
// TODO: move the weird stuff from music_midi_base.cpp here, or at least to this lib and call it here return empty;
return {}; #endif // HAVE_SYSTEM_MIDI && __linux__
#endif
#else
return {};
#endif
} }