diff --git a/video_embed_field.module b/video_embed_field.module index 6016faf..1e77e75 100755 --- a/video_embed_field.module +++ b/video_embed_field.module @@ -345,18 +345,22 @@ function template_preprocess_video_embed_field_embed_code(&$variables) { } - // Prepare the URL - if (!stristr($variables['url'], 'http://') && !stristr($variables['url'], 'https://')) { - $variables['url'] = 'http://' . $variables['url']; - } + if (!empty($variables['url')) { + // Prepare the URL + if (!stristr($variables['url'], 'http://') && !stristr($variables['url'], 'https://')) { + $variables['url'] = 'http://' . $variables['url']; + } - // Prepare embed code - if ($handler && isset($handler['function']) && function_exists($handler['function'])) { - $variables['embed_code'] = drupal_render(call_user_func($handler['function'], $variables['url'], $variables['style_settings'])); - } - else { - $variables['embed_code'] = l($variables['url'], $variables['url']); - } + // Prepare embed code + if ($handler && isset($handler['function']) && function_exists($handler['function'])) { + $variables['embed_code'] = drupal_render(call_user_func($handler['function'], $variables['url'], $variables['style_settings'])); + } + else { + $variables['embed_code'] = l($variables['url'], $variables['url']); + } + } else { + $variables['embed_code'] = ''; + } // Prepare video data $variables['data'] = $variables['video_data']; @@ -555,4 +559,4 @@ function _video_embed_field_load_video($hash) { */ function _video_embed_field_hash($video_url, $video_style){ return md5('vef' . $video_url . $video_style); -} \ No newline at end of file +}