Do not enter question loop if there are no questions

This commit is contained in:
Kumi 2022-08-31 10:47:03 +00:00
parent ed728833da
commit f717449bef
Signed by: kumi
GPG key ID: ECBCC9082395383F

View file

@ -143,6 +143,7 @@ if (file_exists($questionfile)) {
$questionsection = $questions->documentElement->getElementsByTagName("questions")->item(0);
if ($questionsection) {
foreach ($questionsection->getElementsByTagName("question") as $question) {
$questiontext = $question->getElementsByTagName("questiontext")->item(0);
$newquestiontext = strip_tags(html_entity_decode($questiontext->textContent));
@ -154,6 +155,7 @@ if (file_exists($questionfile)) {
$answertext->nodeValue = htmlentities($newanswertext, ENT_XML1);
}
}
}
$questions->save($questionfile);
}