Skip to content

Commit

Permalink
OpenclDevice: Catch negative index (CID 1395110)
Browse files Browse the repository at this point in the history
This fixes a warning from CoverityScan.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
  • Loading branch information
stweil committed Oct 16, 2018
1 parent 98843e0 commit 2d2b269
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/opencl/openclwrapper.cpp
Expand Up @@ -2573,11 +2573,13 @@ ds_device OpenclDevice::getDeviceSelection() {
bestDeviceIdx = d;
}
}
tprintf("[DS] Selected Device[%i]: \"%s\" (%s)\n", bestDeviceIdx + 1,
profile->devices[bestDeviceIdx].oclDeviceName,
profile->devices[bestDeviceIdx].type == DS_DEVICE_OPENCL_DEVICE
if (bestDeviceIdx >= 0) {
tprintf("[DS] Selected Device[%i]: \"%s\" (%s)\n", bestDeviceIdx + 1,
profile->devices[bestDeviceIdx].oclDeviceName,
profile->devices[bestDeviceIdx].type == DS_DEVICE_OPENCL_DEVICE
? "OpenCL"
: "Native");
}
// cleanup
// TODO: call destructor for profile object?

Expand Down

0 comments on commit 2d2b269

Please sign in to comment.