Skip to content
This repository has been archived by the owner on Feb 9, 2021. It is now read-only.

Commit

Permalink
Fixed #2392
Browse files Browse the repository at this point in the history
  • Loading branch information
shoghicp committed Dec 12, 2014
1 parent 312e064 commit 2752393
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/pocketmine/entity/Living.php
Original file line number Diff line number Diff line change
Expand Up @@ -252,9 +252,13 @@ public function getLineOfSight($maxDistance, $maxLength = 0, array $transparent
* @return Block
*/
public function getTargetBlock($maxDistance, array $transparent = []){
$block = array_shift($this->getLineOfSight($maxDistance, 1, $transparent));
if($block instanceof Block){
return $block;
try{
$block = $this->getLineOfSight($maxDistance, 1, $transparent)[0];
if($block instanceof Block){
return $block;
}
}catch (\ArrayOutOfBoundsException $e){

}

return null;
Expand Down

0 comments on commit 2752393

Please sign in to comment.