From 1a36d4fec45242dd3443dd2ced489a593c0cac88 Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Tue, 12 May 2009 22:48:59 +0000 Subject: parent() should return null if there's no parent id --- core/libraries/ORM_MPTT.php | 3 +++ 1 file changed, 3 insertions(+) (limited to 'core') diff --git a/core/libraries/ORM_MPTT.php b/core/libraries/ORM_MPTT.php index 265cb8fb..f64ec200 100644 --- a/core/libraries/ORM_MPTT.php +++ b/core/libraries/ORM_MPTT.php @@ -117,6 +117,9 @@ class ORM_MPTT_Core extends ORM { * @return ORM */ function parent() { + if (!$this->parent_id) { + return null; + } return model_cache::get($this->model_name, $this->parent_id); } -- cgit v1.2.3