Unhandled Error!

Trying to get property of non-object

Document Product details page.
Document type CMS page
Line 5
Exception class Cms_ExecutionException

Code Highlight

<?
$category_menu = NULL;
$subcats = NULL;
// Create Secondary Menu
if ($product->category_list->count) {
	$category_menu = $product->category_list->first();
	$categories = $product->category_list;
	// Set secondary menu
	$subcats = $category_menu->list_children('front_end_sort_order');
	if(!$subcats->count && $category_menu->parent != NULL) {
		$subcats = $category_menu->parent->list_children('front_end_sort_order');
	}
}
# Document Type
1 Product details page. CMS page