Skip to content

Commit

Permalink
fix(likes): check for a valid entity in menu setup
Browse files Browse the repository at this point in the history
It was assumed a valid entity was provided in the menu hook, this is not
always the case. So now it's validated

fixes: #9371
  • Loading branch information
jeabakker committed Oct 11, 2016
1 parent be3415d commit 9ae99e8
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions mod/likes/start.php
Expand Up @@ -93,8 +93,10 @@ function likes_entity_menu_setup($hook, $type, $return, $params) {
return $return; return $return;
} }


$entity = $params['entity']; $entity = elgg_extract('entity', $params);
/* @var ElggEntity $entity */ if (!($entity instanceof \ElggEntity)) {
return $return;
}


$type = $entity->type; $type = $entity->type;
$subtype = $entity->getSubtype(); $subtype = $entity->getSubtype();
Expand Down

0 comments on commit 9ae99e8

Please sign in to comment.