--- a/pathologic.module
+++ b/pathologic.module
@@ -115,18 +115,22 @@ function _pathologic($text, $filter) {
  */
 function _pathologic_replace($matches, $absolute) {
   // First, "files:" support. This is fairly easy.
-  if ($matches[2] === 'files:') {
+  if (isset($matches[2]) && $matches[2] === 'files:') {
     return $matches[1] . '="' . file_create_url(file_build_uri(urldecode($matches[3]))) . '"';
   }
   // Build the full URL, then take it apart
-  $parts = parse_url('http://example.com/' . urldecode($matches[3]));
-  if ($parts['path'] === '/' || $parts['path'] === '//') {
-    // '//' will be the case if the original path was just a slash
-    $parts['path'] = '<front>';
-  }
-  else {
-    // Trim initial slash off path.
-    $parts['path'] = drupal_substr($parts['path'], 1);
+  if (isset($matches[3])){
+    $parts = parse_url('http://example.com/' . urldecode($matches[3]));
+    if ($parts['path'] === '/' || $parts['path'] === '//') {
+      // '//' will be the case if the original path was just a slash
+      $parts['path'] = '<front>';
+    }
+    else {
+      // Trim initial slash off path.
+      $parts['path'] = drupal_substr($parts['path'], 1);
+    }
+  } else {
+    $parts = parse_url('http://example.com/');
   }
 
   // Need to parse the query parts

