diff --git a/src/app/mainview/components/CallActionBar.qml b/src/app/mainview/components/CallActionBar.qml index 15c0b9b1e1d7fd6cc1b0449453d2146e0999a02a..159ca617bb4e0bbba42ad570463fd370f3d561be 100644 --- a/src/app/mainview/components/CallActionBar.qml +++ b/src/app/mainview/components/CallActionBar.qml @@ -89,9 +89,7 @@ Control { } function accept(index) { AvAdapter.stopAudioMeter() - AVModel.setInputDevice(listModel.data( - listModel.index(index, 0), - AudioDeviceModel.RawDeviceName)) + AVModel.setInputDevice(index) AvAdapter.startAudioMeter() } }, diff --git a/src/libclient/avmodel.cpp b/src/libclient/avmodel.cpp index 932e3fbee048bedcd5a64ec5a34fec4912874311..02b8e3f13d3eaff0aa371210c98caba9a4cc0550 100644 --- a/src/libclient/avmodel.cpp +++ b/src/libclient/avmodel.cpp @@ -782,7 +782,7 @@ AVModelPimpl::getDevice(int type) const { if (type < 0 || type > 2) return {}; // No device - QString result = ""; + QString result; VectorString devices; switch (type) { case 1: // INPUT @@ -797,16 +797,12 @@ AVModelPimpl::getDevice(int type) const } QStringList currentDevicesIdx = ConfigurationManager::instance().getCurrentAudioDevicesIndex(); try { - if (currentDevicesIdx.size() < 3) { - // Should not happen, but cannot retrieve current ringtone device + // Should not happen, but cannot retrieve current ringtone device + if (currentDevicesIdx.size() < 3) return ""; - } auto deviceIdx = currentDevicesIdx[type].toInt(); - if (deviceIdx > devices.size()) { - // Should not happen, but cannot retrieve current ringtone device - return ""; - } - result = devices[deviceIdx]; + if (deviceIdx < devices.size()) + result = devices.at(deviceIdx); } catch (std::bad_alloc& ba) { qWarning() << "bad_alloc caught: " << ba.what(); return "";