> 
> **Possible Duplicate:**  
> 
> [Any reason why Mage::registry(‘current\_category’) would return NULL?](https://stackoverflow.com/questions/6264514/any-reason-why-mageregistrycurrent-category-would-return-null)  
> 
> [Reference - What does this error mean in PHP?](https://stackoverflow.com/questions/12769982/reference-what-does-this-error-mean-in-php) 
> 
> 
> 

Fatal error: Call to a member function getParentCategory() on a non-object in...

the code:

```
$_category_detail=Mage::registry('current_category');
$id=$_category_detail->getParentCategory()->getId(); 

```

now, when the page can't use getParentCategory() i using the following but can't work.

```
 if( isset(getParentCategory()){
        $id=$_category_detail->getParentCategory()->getId();  
    }

```

why? thank you