Skip to content

Commit

Permalink
MDL-31807 fix invalid nulls in cohort components
Browse files Browse the repository at this point in the history
Credit goes to Stephen.
  • Loading branch information
skodak committed Mar 3, 2012
1 parent c3e22b1 commit 2ff7800
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions cohort/lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,9 @@ function cohort_add_cohort($cohort) {
*/
function cohort_update_cohort($cohort) {
global $DB;
if (isset($cohort->component) and empty($cohort->component)) {
$cohort->component = NULL;
if (property_exists($cohort, 'component') and empty($cohort->component)) {
// prevent NULLs
$cohort->component = '';
}
$cohort->timemodified = time();
$DB->update_record('cohort', $cohort);
Expand Down

0 comments on commit 2ff7800

Please sign in to comment.