aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShow Liu <show.liu@linaro.org>2015-07-29 16:59:46 +0800
committerShow Liu <show.liu@linaro.org>2015-07-29 16:59:46 +0800
commit1fe9ecb67baa368118f275fa87021069cb178a28 (patch)
treeca2333149299670fa99d3b007b4570a4b6f7cd76
parentf3f4005c33973e3b396c35b72684051da96beb43 (diff)
downloadshamrock-1fe9ecb67baa368118f275fa87021069cb178a28.tar.gz
To check the device is NULL or not to avoid the crash issue
-rw-r--r--src/core/kernel.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/core/kernel.cpp b/src/core/kernel.cpp
index 92a0cca..c3fe391 100644
--- a/src/core/kernel.cpp
+++ b/src/core/kernel.cpp
@@ -83,6 +83,10 @@ Kernel::~Kernel()
static bool matchDeviceOrParent(DeviceInterface *device_dep, DeviceInterface *device)
{
bool match = (device_dep == device);
+
+ if (device == NULL)
+ return match;
+
DeviceInterface *next_device = device->parentDevice();
// If no match, device could be a sub-device - so go up the hierarchy checking parents:
@@ -757,6 +761,9 @@ cl_int Kernel::workGroupInfo(DeviceInterface *device,
cl_ulong cl_ulong_var;
};
+ if (device == NULL)
+ return CL_INVALID_DEVICE;
+
const DeviceDependent &dep = deviceDependent(device);
if ((!device && p_device_dependent.size() > 1) || (&dep == &null_dep))