diff options
author | Vladimir Belyavsky <belyavskyv@gmail.com> | 2023-09-15 18:00:11 +0300 |
---|---|---|
committer | Vladimir Belyavsky <belyavskyv@gmail.com> | 2023-09-18 12:21:44 +0000 |
commit | 6b4cc9bf7358176890630879dbdd08f6d4535bd9 (patch) | |
tree | 9e7ffbddb3f5c44ab6792ece2268fc2656019dff /src/network/kernel | |
parent | 1e25bf5f4d79fa947a6c82cfd7b5adff9c910ca5 (diff) |
QNetworkConnectionEvents: fix potential nullptr access
Fix potential nullptr access in
QNetworkConnectionEvents::getNetworkConnectionFromAdapterGuid().
This can happen if for some reason the NetworkListManager instance
failed to be instantiated in QNetworkConnectionEvents constructor.
Fixes: QTBUG-117097
Pick-to: 6.6 6.5
Change-Id: If51ea383e22461a6c3124576c4e1be3f30dde1f6
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Diffstat (limited to 'src/network/kernel')
-rw-r--r-- | src/network/kernel/qnetconmonitor_win.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/network/kernel/qnetconmonitor_win.cpp b/src/network/kernel/qnetconmonitor_win.cpp index 64bd90b0ad..bf6aff1e46 100644 --- a/src/network/kernel/qnetconmonitor_win.cpp +++ b/src/network/kernel/qnetconmonitor_win.cpp @@ -167,6 +167,12 @@ QNetworkConnectionEvents::~QNetworkConnectionEvents() ComPtr<INetworkConnection> QNetworkConnectionEvents::getNetworkConnectionFromAdapterGuid(QUuid guid) { + if (!networkListManager) { + qCDebug(lcNetMon) << "Failed to enumerate network connections:" + << "NetworkListManager was not instantiated"; + return nullptr; + } + ComPtr<IEnumNetworkConnections> connections; auto hr = networkListManager->GetNetworkConnections(connections.GetAddressOf()); if (FAILED(hr)) { |