WinRTRunner: Fixed access violation when listing phone devices
authorOliver Wolff <oliver.wolff@digia.com>
Fri, 14 Feb 2014 08:22:24 +0000 (09:22 +0100)
committerThe Qt Project <gerrit-noreply@qt-project.org>
Fri, 14 Feb 2014 09:19:03 +0000 (10:19 +0100)
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 <andrew.knight@digia.com>
src/shared/corecon/corecon.cpp

index 73b52ef..c75f080 100644 (file)
@@ -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<CoreConDevice *> CoreConServer::devices() const
 {
     qCDebug(lcCoreCon) << __FUNCTION__;
 
-    if (!d->devices.isEmpty())
+    if (!d->devices.isEmpty() || !d->handle)
         return d->devices;
 
     ComPtr<ICcDatastore> dataStore;