]> git.mjollnir.org Git - moodle.git/commitdiff
Check for empty text strings. Thanks to Quedoc.
authorthepurpleblob <thepurpleblob>
Wed, 21 Mar 2007 11:18:28 +0000 (11:18 +0000)
committerthepurpleblob <thepurpleblob>
Wed, 21 Mar 2007 11:18:28 +0000 (11:18 +0000)
question/format/xml/format.php

index 6c657d63a05903c6d6ba3e3a219707c1ce6e0175..2b0b66280219a5087b6fb720a08125cf0e306cc3 100755 (executable)
@@ -74,6 +74,10 @@ class qformat_xml extends qformat_default {
      * @return string processed text
      */
     function import_text( $text ) {
+        // quick sanity check
+        if (empty($text)) {
+            return '';
+        }
         $data = $text[0]['#'];
         return addslashes(trim( $data ));
     }