summaryrefslogtreecommitdiff
path: root/opencl/source/opencl_device.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'opencl/source/opencl_device.cxx')
-rw-r--r--opencl/source/opencl_device.cxx11
1 files changed, 8 insertions, 3 deletions
diff --git a/opencl/source/opencl_device.cxx b/opencl/source/opencl_device.cxx
index 2acecdf25754..85fea920e379 100644
--- a/opencl/source/opencl_device.cxx
+++ b/opencl/source/opencl_device.cxx
@@ -635,10 +635,15 @@ ds_device getDeviceSelection(
}
/* Final device selection */
- selectedDevice = aProfile->devices[bestDeviceIdx];
- bIsDeviceSelected = true;
+ if (bestDeviceIdx >=0 && static_cast< std::vector<ds_device>::size_type> ( bestDeviceIdx ) < aProfile->devices.size() )
+ {
+ selectedDevice = aProfile->devices[bestDeviceIdx];
+ bIsDeviceSelected = true;
- writeDevicesLog(aProfile, sProfilePath, bestDeviceIdx);
+ writeDevicesLog(aProfile, sProfilePath, bestDeviceIdx);
+ } else {
+ selectedDevice.eType = DeviceType::NativeCPU;
+ }
}
return selectedDevice;
}