From 494dc4da7b1d8bc87306d836b37b320657f71f78 Mon Sep 17 00:00:00 2001 From: Oliver Wolff Date: Fri, 14 Feb 2014 09:22:24 +0100 Subject: [PATCH] WinRTRunner: Fixed access violation when listing phone devices In case of an x64 environment phone devices cannot be listed, but winrtrunner should not crash in this case. Change-Id: I6963e1c4f2dc73424fa7ebde13cbce759dfaabc4 Reviewed-by: Andrew Knight --- src/shared/corecon/corecon.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/shared/corecon/corecon.cpp b/src/shared/corecon/corecon.cpp index 73b52ef..c75f080 100644 --- a/src/shared/corecon/corecon.cpp +++ b/src/shared/corecon/corecon.cpp @@ -138,7 +138,8 @@ public: CoreConServer::CoreConServer() : d(new CoreConServerPrivate) { HRESULT hr = CoCreateInstance(CLSID_ConMan, NULL, CLSCTX_INPROC_SERVER, IID_PPV_ARGS(&d->handle)); - qCDebug(lcCoreCon) << "Failed to initialize connection server." << formatError(hr); + if (FAILED(hr)) + qCWarning(lcCoreCon) << "Failed to initialize connection server." << formatError(hr); // The language module is available as long as the above succeeded d->langModule = GetModuleHandle(L"conmanui"); @@ -157,7 +158,7 @@ QList CoreConServer::devices() const { qCDebug(lcCoreCon) << __FUNCTION__; - if (!d->devices.isEmpty()) + if (!d->devices.isEmpty() || !d->handle) return d->devices; ComPtr dataStore; -- 2.7.4