diff options
Diffstat (limited to 'arm_compute/core/CL/CLKernelLibrary.h')
-rw-r--r-- | arm_compute/core/CL/CLKernelLibrary.h | 16 |
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]; + } } } |