Replaced Position->getLevel() null checks with isValid()

This commit is contained in:
Dylan K. Taylor
2018-03-20 11:10:36 +00:00
parent 73e09392b6
commit 1648fff916
7 changed files with 22 additions and 23 deletions

View File

@ -269,8 +269,8 @@ abstract class Tile extends Position{
if(!$this->closed){
$this->closed = true;
if(($level = $this->getLevel()) instanceof Level){
$level->removeTile($this);
if($this->isValid()){
$this->level->removeTile($this);
$this->setLevel(null);
}