aboutsummaryrefslogtreecommitdiff
path: root/arm_compute/core/CL/CLKernelLibrary.h
diff options
context:
space:
mode:
authorAnthony Barbier <anthony.barbier@arm.com>2018-05-11 11:55:09 +0100
committerAnthony Barbier <anthony.barbier@arm.com>2018-11-02 16:51:50 +0000
commitef9e05978ab008e533cc76a8e6f10c9e86a880c1 (patch)
tree1fe63925b4468139877ba9009b61c4f4d086b216 /arm_compute/core/CL/CLKernelLibrary.h
parentb8fc60fc9fe9ad6c48d9618fc65753fbe5813216 (diff)
downloadComputeLibrary-ef9e05978ab008e533cc76a8e6f10c9e86a880c1.tar.gz
COMPMID-1122: Don't try to retrieve the list of devices from a null context
Change-Id: Ib50b1e4f4464e9386a69eb631c187ad5b1130aa7 Reviewed-on: https://eu-gerrit-1.euhpc.arm.com/130859 Reviewed-by: Derek Lamberti <derek.lamberti@arm.com> Tested-by: Jenkins <bsgcomp@arm.com> Reviewed-by: Georgios Pinitas <georgios.pinitas@arm.com>
Diffstat (limited to 'arm_compute/core/CL/CLKernelLibrary.h')
-rw-r--r--arm_compute/core/CL/CLKernelLibrary.h16
1 files changed, 11 insertions, 5 deletions
diff --git a/arm_compute/core/CL/CLKernelLibrary.h b/arm_compute/core/CL/CLKernelLibrary.h
index 2511966102..f0dc0b24cf 100644
--- a/arm_compute/core/CL/CLKernelLibrary.h
+++ b/arm_compute/core/CL/CLKernelLibrary.h
@@ -249,16 +249,22 @@ public:
void set_context(cl::Context context)
{
_context = std::move(context);
-
- const auto cl_devices = _context.getInfo<CL_CONTEXT_DEVICES>();
-
- if(cl_devices.empty())
+ if(_context.get() == nullptr)
{
_device = cl::Device();
}
else
{
- _device = cl_devices[0];
+ const auto cl_devices = _context.getInfo<CL_CONTEXT_DEVICES>();
+
+ if(cl_devices.empty())
+ {
+ _device = cl::Device();
+ }
+ else
+ {
+ _device = cl_devices[0];
+ }
}
}