From e53e7bc600750595192122693776928a550c254b Mon Sep 17 00:00:00 2001 From: Albert Vaca Cintora Date: Thu, 25 May 2023 13:08:10 +0200 Subject: [PATCH] Fix really terrible code --- plugins/systemvolume/systemvolumeplugin-win.cpp | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/plugins/systemvolume/systemvolumeplugin-win.cpp b/plugins/systemvolume/systemvolumeplugin-win.cpp index 82513b3c8..226c16bee 100644 --- a/plugins/systemvolume/systemvolumeplugin-win.cpp +++ b/plugins/systemvolume/systemvolumeplugin-win.cpp @@ -409,14 +409,12 @@ bool SystemvolumePlugin::receivePacket(const NetworkPacket &np) } else { QString name = np.get(QStringLiteral("name")); - if (sinkList.contains(name)) { - // unregister ControlChangeNotify before doing any changes to a sink - HRESULT unregisterSuccess = E_POINTER; - auto sinkListIterator = this->sinkList.find(name); + auto sinkListIterator = this->sinkList.find(name); + if (sinkListIterator != this->sinkList.end()) { auto &sink = sinkListIterator.value(); - if (!(sinkListIterator == this->sinkList.end())) { - unregisterSuccess = sink.first->UnregisterControlChangeNotify(sink.second); - } + + // unregister ControlChangeNotify before doing any changes to a sink + HRESULT unregisterSuccess = sink.first->UnregisterControlChangeNotify(sink.second); if (np.has(QStringLiteral("volume"))) { float currentVolume;