From ef9e05978ab008e533cc76a8e6f10c9e86a880c1 Mon Sep 17 00:00:00 2001 From: Anthony Barbier Date: Fri, 11 May 2018 11:55:09 +0100 Subject: 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 Tested-by: Jenkins Reviewed-by: Georgios Pinitas --- arm_compute/core/CL/CLKernelLibrary.h | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'arm_compute/core/CL') 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(); - - if(cl_devices.empty()) + if(_context.get() == nullptr) { _device = cl::Device(); } else { - _device = cl_devices[0]; + const auto cl_devices = _context.getInfo(); + + if(cl_devices.empty()) + { + _device = cl::Device(); + } + else + { + _device = cl_devices[0]; + } } } -- cgit v1.2.1