]> gitweb.fluxo.info Git - lorea/elgg.git/commitdiff
Checking for a valid entity before using its methods in update_entity().
authorbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>
Sun, 10 Oct 2010 19:00:20 +0000 (19:00 +0000)
committerbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>
Sun, 10 Oct 2010 19:00:20 +0000 (19:00 +0000)
git-svn-id: http://code.elgg.org/elgg/trunk@7049 36083f99-b078-4883-b0ff-0f9b5a30f544

engine/lib/entities.php

index e35252619c8e07da00fcc319652335412540cac0..534b61e19effe577a22f377e895c8c287f2ff6ce 100644 (file)
@@ -376,7 +376,7 @@ function update_entity($guid, $owner_guid, $access_id, $container_guid = null) {
 
        $entity = get_entity($guid);
 
-       if ($entity->canEdit()) {
+       if ($entity && $entity->canEdit()) {
                if (trigger_elgg_event('update', $entity->type, $entity)) {
                        $ret = update_data("UPDATE {$CONFIG->dbprefix}entities set owner_guid='$owner_guid', access_id='$access_id', container_guid='$container_guid', time_updated='$time' WHERE guid=$guid");