diff --git a/entity.test b/entity.test
index 746713e..ddea57c 100644
--- a/entity.test
+++ b/entity.test
@@ -1619,3 +1619,41 @@ class EntityMetadataIntegrationTestCase extends EntityWebTestCase {
     }
   }
 }
+
+/**
+ * Test file deletion.
+ */
+class EntityMetadataFileDeletionTestCase extends EntityWebTestCase {
+
+  public static function getInfo() {
+    return array(
+      'name' => 'File Deletion',
+      'description' => 'Tests using metadata wrapper for drupal core.',
+      'group' => 'Entity API',
+    );
+  }
+
+  function setUp() {
+    parent::setUp('entity');
+  }
+
+  /**
+   * entity_metadata_delete_file() should never throw an exception.
+   *
+   * We assume that there is no valid fid 2147483647.
+   */
+  public function testFileDeletionForBadFID() {
+    $fids = array(2147483647, '2147483647');
+    foreach($fids as $fid) {
+      try {
+        entity_metadata_delete_file($fid);
+      }
+      catch (Exception $e) {
+        $this->fail('Failed to handle a bad $fid.');
+        continue;
+      }
+      $this->pass('Handled a bad $fid.');
+    }
+  }
+
+}
\ No newline at end of file
diff --git a/modules/callbacks.inc b/modules/callbacks.inc
index 304f53f..8a03a1e 100644
--- a/modules/callbacks.inc
+++ b/modules/callbacks.inc
@@ -804,10 +804,14 @@ function entity_metadata_user_save($account) {
 
 /**
  * Callback to delete a file.
- * Watch out to not accidentilly implement hook_file_delete().
+ *
+ * Watch out to not accidentally implement hook_file_delete().
  */
 function entity_metadata_delete_file($fid) {
-  file_delete(file_load($fid), TRUE);
+  // Verify that $fid is valid before trying to delete.
+  if ($file = file_load($fid)) {
+    file_delete($file, TRUE);
+  }
 }
 
 /**
