diff --git a/modules/gui/qt/components/audio_device_model.cpp b/modules/gui/qt/components/audio_device_model.cpp index cb2b9bfdf4089054c5ef0d3a9cba6d267ece6804..272e429128a61471730d5c46d2c1ade129fe3f07 100644 --- a/modules/gui/qt/components/audio_device_model.cpp +++ b/modules/gui/qt/components/audio_device_model.cpp @@ -46,8 +46,8 @@ AudioDeviceModel::AudioDeviceModel(vlc_player_t *player, QObject *parent) } m_aout = vlc_player_aout_Hold(m_player); - - m_inputs = aout_DevicesList(m_aout, &m_ids, &m_names); + if (m_aout) + m_inputs = aout_DevicesList(m_aout, &m_ids, &m_names); } AudioDeviceModel::~AudioDeviceModel() @@ -66,8 +66,8 @@ AudioDeviceModel::~AudioDeviceModel() vlc_player_locker locker{m_player}; vlc_player_aout_RemoveListener(m_player, m_player_aout_listener); - aout_Release(m_aout); - + if (m_aout) + aout_Release(m_aout); } Qt::ItemFlags AudioDeviceModel::flags(const QModelIndex &) const diff --git a/modules/gui/qt/components/audio_device_model.hpp b/modules/gui/qt/components/audio_device_model.hpp index 1721990d5ed910c41461ebe7911fe331db833138..3b5fb6d419982dba6861ce7aca26a9e4151cf151 100644 --- a/modules/gui/qt/components/audio_device_model.hpp +++ b/modules/gui/qt/components/audio_device_model.hpp @@ -52,7 +52,7 @@ public: QHash<int, QByteArray> roleNames() const override; private: - int m_inputs; + int m_inputs = 0; char **m_names; char **m_ids; QString m_current;