--- /www/naturart/sites/all/modules/imagecache/imagecache.module	2008-06-20 02:21:42.000000000 +0200
+++ /www/naturart/sites/default/modules/imagecache/imagecache.module	2008-08-27 13:49:03.000000000 +0200
@@ -548,22 +548,23 @@ function imagecache_field_formatter($fie
     switch ($style) {
       case 'linked':
         $imagetag =  theme('imagecache', $presetname, $item['filepath'], $item['alt'], $item['title']);
-        return l($imagetag, 'node/'. $node->nid, array('class' => $class), null, null, false, true); 
-    
+        $return = $imagetag ? l($imagetag, 'node/'. $node->nid, array('class' => $class), null, null, false, true) : ''; 
+
       case 'imagelink':
         $original_image_url = file_create_url($item['filepath']);
         $imagetag =  theme('imagecache', $presetname, $item['filepath'], $item['alt'], $item['title']);
-        return l($imagetag, $original_image_url, array('class' => $class), null, null, false, true);
+        $return = $imagetag ? l($imagetag, $original_image_url, array('class' => $class), null, null, false, true) : ''; 
 
       case 'url':
-        return imagecache_create_url($presetname, $item['filepath']);
+        $return = $item['filepath'] ? imagecache_create_url($presetname, $item['filepath']) : '';
 
       case 'path':
-        return imagecache_create_path($presetname, $item['filepath']);
+        $return = $item['filepath'] ? imagecache_create_path($presetname, $item['filepath']) : '';
 
       default:
-        return  theme('imagecache', $presetname, $item['filepath'], $item['alt'], $item['title']);
+        $return = $item['filepath'] ? theme('imagecache', $presetname, $item['filepath'], $item['alt'], $item['title']) : '';
     }
+    return $return;
   }
   return '<!-- imagecache formatter preset('. $presetname .') not found! -->';
 }
@@ -657,14 +658,19 @@ function _imagecache_recursive_delete($d
  */
 
 function theme_imagecache($namespace, $path, $alt = '', $title = '', $attributes = null) {
-  // check is_null so people can intentionally pass an empty array of attributes to override
-  // the defaults completely... if 
-  if (is_null($attributes)) {
-    $attributes['class'] = 'imagecache imagecache-'. $namespace;
-  } 
-  $attributes = drupal_attributes($attributes);
-  $imagecache_url = imagecache_create_url($namespace, $path);
-  return '<img src="'. $imagecache_url .'" alt="'. check_plain($alt) .'" title="'. check_plain($title) .'" '. $attributes .' />';
+  if ($path) {
+    // check is_null so people can intentionally pass an empty array of attributes to override
+    // the defaults completely... if 
+    if (is_null($attributes)) {
+      $attributes['class'] = 'imagecache imagecache-'. $namespace;
+    } 
+    $attributes = drupal_attributes($attributes);
+    $imagecache_url = imagecache_create_url($namespace, $path);
+    return '<img src="'. $imagecache_url .'" alt="'. check_plain($alt) .'" title="'. check_plain($title) .'" '. $attributes .' />';
+  }
+  else {
+    return '';
+  }
 }
 
 
