]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-17140 should check if $data->id isn't empty before sending to get_record
authordanmarsden <danmarsden>
Thu, 6 Nov 2008 01:04:40 +0000 (01:04 +0000)
committerdanmarsden <danmarsden>
Thu, 6 Nov 2008 01:04:40 +0000 (01:04 +0000)
user/profile/definelib.php

index f94749d77ed5c624dad0800f695ef61c0c3d41fc..c0a96ba06d80d6748d94115820fee47cb19d34b7 100644 (file)
@@ -143,7 +143,10 @@ class profile_define_base {
 
         $data = $this->define_save_preprocess($data); /// hook for child classes
 
-        $old = $DB->get_record('user_info_field', array('id'=>(int)$data->id));
+        $old = false;
+        if (!empty($data->id)) {
+            $old = $DB->get_record('user_info_field', array('id'=>(int)$data->id));
+        }
 
         /// check to see if the category has changed
         if (!$old or $old->categoryid != $data->categoryid) {