Index: reg_with_pic.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/reg_with_pic/reg_with_pic.module,v
retrieving revision 1.1
diff -u -p -r1.1 reg_with_pic.module
--- reg_with_pic.module	15 Nov 2007 22:31:30 -0000	1.1
+++ reg_with_pic.module	31 Jul 2009 19:01:15 -0000
@@ -32,16 +32,17 @@ function reg_with_pic_user($op, &$edit, 
         $file = file_save_upload('picture_upload_register', $validators);
         break;
 
-      case 'insert':
+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($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);
+          }
         }
         break;
     }
   }

