--- reg_with_pic.module.orig	2007-11-15 23:31:30.000000000 +0100
+++ reg_with_pic.module	2008-10-28 11:04:00.000000000 +0100
@@ -35,13 +35,15 @@ function reg_with_pic_user($op, &$edit, 
       case 'insert':
         // file repopulates from uploadcache
         $file = file_save_upload('picture_upload_register');
-        $info = image_get_info($file->filepath);
-        // save picture to correct path and update the row in the user table
-        $destination = variable_get('user_picture_path', 'pictures') .'/picture-'. $user->uid .'.'. $info['extension'];
-        if (file_copy($file, $destination, FILE_EXISTS_REPLACE)) {
-          db_query("UPDATE {users} SET picture='%s' WHERE uid=%d", $file->filepath, $user->uid);
+        if (is_object($file)) {
+          $info = image_get_info($file->filepath);
+          // save picture to correct path and update the row in the user table
+          $destination = variable_get('user_picture_path', 'pictures') .'/picture-'. $user->uid .'.'. $info['extension'];
+          if (file_copy($file, $destination, FILE_EXISTS_REPLACE)) {
+            db_query("UPDATE {users} SET picture='%s' WHERE uid=%d", $file->filepath, $user->uid);
+          }
         }
         break;
     }
   }
-}
\ No newline at end of file
+}
