File tree Expand file tree Collapse file tree 1 file changed +4
-0
lines changed Expand file tree Collapse file tree 1 file changed +4
-0
lines changed Original file line number Diff line number Diff line change @@ -2029,6 +2029,7 @@ struct Context::Impl
2029
2029
{
2030
2030
if (prefix.empty ())
2031
2031
{
2032
+ CV_Assert (!devices.empty ());
2032
2033
const Device& d = devices[0 ];
2033
2034
prefix = d.vendorName () + " --" + d.name () + " --" + d.driverVersion ();
2034
2035
// sanitize chars
@@ -3298,6 +3299,8 @@ struct Program::Impl
3298
3299
refcount = 1 ;
3299
3300
const Context ctx = Context::getDefault ();
3300
3301
Device device = ctx.device (0 );
3302
+ if (ctx.ptr () == NULL || device.ptr () == NULL )
3303
+ return ;
3301
3304
if (device.isAMD ())
3302
3305
buildflags += " -D AMD_DEVICE" ;
3303
3306
else if (device.isIntel ())
@@ -3308,6 +3311,7 @@ struct Program::Impl
3308
3311
bool compile (const Context& ctx, String& errmsg)
3309
3312
{
3310
3313
#if OPENCV_HAVE_FILESYSTEM_SUPPORT
3314
+ CV_Assert (ctx.getImpl ());
3311
3315
OpenCLBinaryCacheConfigurator& config = OpenCLBinaryCacheConfigurator::getSingletonInstance ();
3312
3316
const std::string base_dir = config.prepareCacheDirectoryForContext (
3313
3317
ctx.getImpl ()->getPrefixString (),
You can’t perform that action at this time.
0 commit comments