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 @@ -1973,6 +1973,7 @@ struct Context::Impl
1973
1973
{
1974
1974
if (prefix.empty ())
1975
1975
{
1976
+ CV_Assert (!devices.empty ());
1976
1977
const Device& d = devices[0 ];
1977
1978
prefix = d.vendorName () + " --" + d.name () + " --" + d.driverVersion ();
1978
1979
// sanitize chars
@@ -3222,6 +3223,8 @@ struct Program::Impl
3222
3223
refcount = 1 ;
3223
3224
const Context ctx = Context::getDefault ();
3224
3225
Device device = ctx.device (0 );
3226
+ if (ctx.ptr () == NULL || device.ptr () == NULL )
3227
+ return ;
3225
3228
if (device.isAMD ())
3226
3229
buildflags += " -D AMD_DEVICE" ;
3227
3230
else if (device.isIntel ())
@@ -3232,6 +3235,7 @@ struct Program::Impl
3232
3235
bool compile (const Context& ctx, String& errmsg)
3233
3236
{
3234
3237
#if OPENCV_HAVE_FILESYSTEM_SUPPORT
3238
+ CV_Assert (ctx.getImpl ());
3235
3239
OpenCLBinaryCacheConfigurator& config = OpenCLBinaryCacheConfigurator::getSingletonInstance ();
3236
3240
const std::string base_dir = config.prepareCacheDirectoryForContext (ctx.getImpl ()->getPrefixString ());
3237
3241
const std::string fname = base_dir.empty () ? std::string () :
You can’t perform that action at this time.
0 commit comments