summaryrefslogtreecommitdiff
path: root/modules/taxonomy/taxonomy.module
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2010-08-22 15:45:03 +0000
committerDries Buytaert <dries@buytaert.net>2010-08-22 15:45:03 +0000
commit1651cf34bfbdf02f6c03f8d00b025a610d24df23 (patch)
treec465620cce66fa7937a8b5f7b26cd7434adef819 /modules/taxonomy/taxonomy.module
parent153ef8bd7b79fa4063a3994cd653721249e9c465 (diff)
downloadbrdo-1651cf34bfbdf02f6c03f8d00b025a610d24df23.tar.gz
brdo-1651cf34bfbdf02f6c03f8d00b025a610d24df23.tar.bz2
- Patch #841798 by klausi: error deleting an invalid term.
Diffstat (limited to 'modules/taxonomy/taxonomy.module')
-rw-r--r--modules/taxonomy/taxonomy.module24
1 files changed, 12 insertions, 12 deletions
diff --git a/modules/taxonomy/taxonomy.module b/modules/taxonomy/taxonomy.module
index b060a8dcb..cb1f25592 100644
--- a/modules/taxonomy/taxonomy.module
+++ b/modules/taxonomy/taxonomy.module
@@ -570,18 +570,18 @@ function taxonomy_term_delete($tid) {
}
}
- $term = taxonomy_term_load($tid);
-
- db_delete('taxonomy_term_data')
- ->condition('tid', $tid)
- ->execute();
- db_delete('taxonomy_term_hierarchy')
- ->condition('tid', $tid)
- ->execute();
-
- field_attach_delete('taxonomy_term', $term);
- module_invoke_all('taxonomy_term_delete', $term);
- taxonomy_terms_static_reset();
+ if ($term = taxonomy_term_load($tid)) {
+ db_delete('taxonomy_term_data')
+ ->condition('tid', $tid)
+ ->execute();
+ db_delete('taxonomy_term_hierarchy')
+ ->condition('tid', $tid)
+ ->execute();
+
+ field_attach_delete('taxonomy_term', $term);
+ module_invoke_all('taxonomy_term_delete', $term);
+ taxonomy_terms_static_reset();
+ }
}
$tids = $orphans;