diff --git a/modules/file/file.module b/modules/file/file.module
index 4002701..d0cced9 100644
--- a/modules/file/file.module
+++ b/modules/file/file.module
@@ -777,26 +777,28 @@ function file_icon_path($file, $icon_directory = NULL) {
     $icon_directory = variable_get('file_icon_directory', drupal_get_path('module', 'file') . '/icons');
   }
 
-  // If there's an icon matching the exact mimetype, go for it.
-  $dashed_mime = strtr($file->filemime, array('/' => '-'));
-  $icon_path = $icon_directory . '/' . $dashed_mime . '.png';
-  if (file_exists($icon_path)) {
-    return $icon_path;
-  }
+  if (!empty($file->filemime)) {
+  	// If there's an icon matching the exact mimetype, go for it.
+    $dashed_mime = strtr($file->filemime, array('/' => '-'));
+    $icon_path = $icon_directory . '/' . $dashed_mime . '.png';
+    if (file_exists($icon_path)) {
+      return $icon_path;
+    }
 
-  // For a few mimetypes, we can "manually" map to a generic icon.
-  $generic_mime = (string) file_icon_map($file);
-  $icon_path = $icon_directory . '/' . $generic_mime . '.png';
-  if ($generic_mime && file_exists($icon_path)) {
-    return $icon_path;
-  }
+    // For a few mimetypes, we can "manually" map to a generic icon.
+    $generic_mime = (string) file_icon_map($file);
+    $icon_path = $icon_directory . '/' . $generic_mime . '.png';
+    if ($generic_mime && file_exists($icon_path)) {
+      return $icon_path;
+    }
 
-  // Use generic icons for each category that provides such icons.
-  foreach (array('audio', 'image', 'text', 'video') as $category) {
-    if (strpos($file->filemime, $category . '/') === 0) {
-      $icon_path = $icon_directory . '/' . $category . '-x-generic.png';
-      if (file_exists($icon_path)) {
-        return $icon_path;
+    // Use generic icons for each category that provides such icons.
+    foreach (array('audio', 'image', 'text', 'video') as $category) {
+      if (strpos($file->filemime, $category . '/') === 0) {
+        $icon_path = $icon_directory . '/' . $category . '-x-generic.png';
+        if (file_exists($icon_path)) {
+          return $icon_path;
+        }
       }
     }
   }
