From b9ba29f290b86c6ac42fd3240dafcc986361033a Mon Sep 17 00:00:00 2001
From: Graham Cole <chckens@sucs.org>
Date: Thu, 11 Sep 2008 15:30:29 +0000
Subject: [PATCH] stop things breaking horribly if no planet atom.xml is
 present (e.g. with clean checkouts of the site)

---
 components/planetposts.php | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/components/planetposts.php b/components/planetposts.php
index 15d1a17..860c6ba 100644
--- a/components/planetposts.php
+++ b/components/planetposts.php
@@ -6,7 +6,13 @@ $num_entries = 5;
 unset($result);
 $planetposts = array();
 
-$xmldata = file_get_contents("../htdocs/planet/atom.xml");
+$xmldata = @file_get_contents("../htdocs/planet/atom.xml");
+
+if (!$xmldata) {
+	trigger_error("No planet atom.xml data loaded", E_USER_WARNING);
+	return;
+} 
+
 $simplexml = simplexml_load_string($xmldata);
 $xml = $simplexml->children('http://www.w3.org/2005/Atom');
 
-- 
GitLab