From e90a1813aea09001c84fd145869d912b2f6ed7a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?N=C3=A9munaire?= Date: Wed, 23 May 2012 17:46:34 +0200 Subject: [PATCH] Question getter now return null if the question isn't found --- QuestionsFile.class.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/QuestionsFile.class.php b/QuestionsFile.class.php index f4228f3..904dffc 100644 --- a/QuestionsFile.class.php +++ b/QuestionsFile.class.php @@ -52,7 +52,11 @@ class QuestionsFile */ public function get_question($id) { - return new Question($this->treeXML->getElementById($id)); + $q = $this->treeXML->getElementById($id); + if (isset($q)) + return new Question($q); + else + return NULL; } /**