From fee10fa472fdb71917d2d16e2c97aac160f7d8ae Mon Sep 17 00:00:00 2001
From: arknoll <arknoll@853506.no-reply.drupal.org>
Date: Fri, 1 Feb 2013 11:15:53 -0700
Subject: [PATCH] Issue #1831492 by arknoll: Fix for undefined offset error.

---
 resp_img.module |    8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/resp_img.module b/resp_img.module
index d8e5372..da35bcf 100644
--- a/resp_img.module
+++ b/resp_img.module
@@ -375,9 +375,11 @@ function _resp_img_replace($content) {
   foreach ($new_imgs as &$img) {
     $src = array();
     preg_match('/src=("[^"]*")/i', $img, $src);
-    $src = $src[1];
-    $new_src = resp_img_replace_suffix($src);
-    $img = str_replace($src, $new_src, $img);
+    $src = (isset($src[1])) ? $src[1] : '';
+    if(!empty($src)) {
+      $new_src = resp_img_replace_suffix($src);
+      $img = str_replace($src, $new_src, $img);
+    }
   }
   $content = str_replace($orig_imgs, $new_imgs, $content);
   return $content;
-- 
1.7.10.2 (Apple Git-33)

