Permalink
Browse files

Check for empty text strings. Thanks to Quedoc.

  • Loading branch information...
thepurpleblob
thepurpleblob committed Mar 21, 2007
1 parent e6b8565 commit 6282be2fd9b16e05f5b90f98b26d1d9dcee09dec
Showing with 4 additions and 0 deletions.
  1. +4 −0 question/format/xml/format.php
@@ -71,6 +71,10 @@ function trans_single( $name ) {
* @return string processed text
*/
function import_text( $text ) {
+ // quick sanity check
+ if (empty($text)) {
+ return '';
+ }
$data = $text[0]['#'];
return addslashes(trim( $data ));
}

0 comments on commit 6282be2

Please sign in to comment.