Index: modules/image/image.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/image/image.module,v
retrieving revision 1.52
diff -u -p -r1.52 image.module
--- modules/image/image.module	24 Sep 2010 00:37:43 -0000	1.52
+++ modules/image/image.module	30 Sep 2010 13:47:53 -0000
@@ -678,6 +678,14 @@ function image_style_deliver($style, $sc
     }
   }
 
+  // Don't try to generate file if source is missing.
+  if (!file_exists($image_uri)) {
+    watchdog('image', 'Unable to generate the derived image from image at %path.', array('%path' => $derivative_uri));
+    drupal_add_http_header('Status', '404 File Not Found');
+    print t('Error generating image, missing source file.');
+    drupal_exit();
+  }
+
   // Don't start generating the image if the derivative already exists or if
   // generation is in progress in another thread.
   $lock_name = 'image_style_deliver:' . $style['name'] . ':' . drupal_hash_base64($image_uri);
