From 20ad8dfbbc8183fd64c28552e77e647976174825 Mon Sep 17 00:00:00 2001 From: Will Rossiter Date: Sat, 26 Jun 2010 04:47:15 +0000 Subject: [PATCH] BUGFIX: getParent() may return null. Prevent calling function on null (esp when running tests) --- code/BlogEntry.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/code/BlogEntry.php b/code/BlogEntry.php index 4f137ee..53a9124 100644 --- a/code/BlogEntry.php +++ b/code/BlogEntry.php @@ -163,14 +163,14 @@ class BlogEntry extends Page { * Link for editing this blog entry */ function EditURL() { - return $this->getParent()->Link('post') . '/' . $this->ID . '/'; + return ($this->getParent()) ? $this->getParent()->Link('post') . '/' . $this->ID . '/' : false; } /** * Check to see if trackbacks are enabled. */ function TrackBacksEnabled() { - return $this->getParent()->TrackBacksEnabled; + return ($this->getParent()) ? $this->getParent()->TrackBacksEnabled : false; } function trackbackping() {