Permalink
Browse files

fix(likes): check for a valid entity in menu setup

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 9ae99e84f31be25d339d84393000a05527fb377b
Showing with 4 additions and 2 deletions.
  1. +4 −2 mod/likes/start.php
View
@@ -93,8 +93,10 @@ function likes_entity_menu_setup($hook, $type, $return, $params) {
return $return;
}
$entity = $params['entity'];
/* @var ElggEntity $entity */
$entity = elgg_extract('entity', $params);
if (!($entity instanceof \ElggEntity)) {
return $return;
}
$type = $entity->type;
$subtype = $entity->getSubtype();

0 comments on commit 9ae99e8

Please sign in to comment.