message: ocl: fix null pointer access crash
diff: @@ -1973,6 +1973,7 @@ struct Context::Impl
  {
  if (prefix.empty())
  {
  + CV_Assert(!devices.empty());
  const Device& d = devices[0];
  prefix = d.vendorName() + "--" + d.name() + "--" + d.driverVersion();
  // sanitize chars
  @@ -3222,6 +3223,8 @@ struct Program::Impl
  refcount = 1;
  const Context ctx = Context::getDefault();
  Device device = ctx.device(0);
  + if (ctx.ptr() == NULL || device.ptr() == NULL)
  + return;
  if (device.isAMD())
  buildflags += " -D AMD_DEVICE";
  else if (device.isIntel())
  @@ -3232,6 +3235,7 @@ struct Program::Impl
  bool compile(const Context& ctx, String& errmsg)
  {
  #if OPENCV_HAVE_FILESYSTEM_SUPPORT
  + CV_Assert(ctx.getImpl());
  OpenCLBinaryCacheConfigurator& config = OpenCLBinaryCacheConfigurator::getSingletonInstance();
  const std::string base_dir = config.prepareCacheDirectoryForContext(ctx.getImpl()->getPrefixString());
  const std::string fname = base_dir.empty() ? std::string() :
  