--- textimage_admin.inc.orig	2010-12-01 16:02:27.000000000 +1100
+++ textimage_admin.inc	2010-12-01 16:09:42.000000000 +1100
@@ -747,7 +747,7 @@ function _textimage_recursive_delete($pa
 function _textimage_font_list($fontdir) {
   $filelist = array();
   if (is_dir($fontdir) && $handle = opendir($fontdir)) {
-    while ($file = readdir($handle)) {
+    while (($file = readdir($handle)) !== FALSE) {
       if (preg_match("/\.[ot]tf$/i", $file) == 1) {
         $font = _textimage_font_name($fontdir .'/'. $file);
         $filelist[$file] = $font['name'];
@@ -861,7 +861,7 @@ function _textimage_hex_validate($field,
 function _textimage_image_list($imagesdir) {
   $filelist = array();
   if (is_dir($imagesdir) && $handle = opendir($imagesdir)) {
-    while ($file = readdir($handle)) {
+    while (($file = readdir($handle)) !== FALSE) {
       if (preg_match("/\.gif|\.png|\.jpg$/i", $file) == 1) {
         $filelist[] = $imagesdir .'/'. $file;
       }
