summaryrefslogtreecommitdiff
path: root/modules/file/file.field.inc
diff options
context:
space:
mode:
Diffstat (limited to 'modules/file/file.field.inc')
-rw-r--r--modules/file/file.field.inc6
1 files changed, 6 insertions, 0 deletions
diff --git a/modules/file/file.field.inc b/modules/file/file.field.inc
index b26d7e457..794f16e67 100644
--- a/modules/file/file.field.inc
+++ b/modules/file/file.field.inc
@@ -252,6 +252,12 @@ function file_field_insert($entity_type, $entity, $field, $instance, $langcode,
* Checks for files that have been removed from the object.
*/
function file_field_update($entity_type, $entity, $field, $instance, $langcode, &$items) {
+ // Check whether the field is defined on the object.
+ if (!isset($entity->{$field['field_name']})) {
+ // We cannot check for removed files if the field is not defined.
+ return;
+ }
+
list($id, $vid, $bundle) = entity_extract_ids($entity_type, $entity);
// On new revisions, all files are considered to be a new usage and no