Index: imagecache.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/imagecache/imagecache.module,v
retrieving revision 1.100
diff -u -p -r1.100 imagecache.module
--- imagecache.module	14 Apr 2009 00:01:21 -0000	1.100
+++ imagecache.module	17 Apr 2009 20:40:46 -0000
@@ -629,7 +629,9 @@ function imagecache_field_formatter_info
 }
 
 function theme_imagecache_formatter($element) {
-  if (isset($element['#item']['nid']) && $node = node_load($element['#item']['nid'])) {
+  if (isset($element['#item']['nid'])) {
+    // All we need is the nid on the node object so this is a lot cheaper than a full load.
+    $node = (object) $element['#item'];
     return imagecache_field_formatter($element['#field_name'], $element['#item'], $element['#formatter'], $node);
   }
 }
@@ -657,7 +659,19 @@ function imagecache_field_formatter($fie
 
   $class = "imagecache imagecache-$presetname imagecache-$style imagecache-$formatter";
   if ($preset = imagecache_preset_by_name($presetname)) {
+    // Prevent crashes when there's no image.
+    if (!is_array($item)) {
+      $item = array();
+    }
+    if (!is_array($item['data'])) {
+      $item['data'] = array(
+        'alt' => '',
+        'title' => '',
+      );
+    }
+
     $item['filepath'] = $item['fid'] == 'upload' ? $item['preview'] : $item['filepath'];
+
     switch ($style) {
       case 'linked':
         $imagetag = theme('imagecache', $presetname, $item['filepath'], $alt, $title);
