Skip to content
Browse files

MDL-35637 group: Fix form submission error that occurs when GD versio…

…n is not set.
  • Loading branch information...
1 parent c366bea commit 40755f958417db53b662217b42502281fd5ea5b1 @markn86 markn86 committed Sep 27, 2012
Showing with 11 additions and 10 deletions.
  1. +11 −10 group/lib.php
View
21 group/lib.php
@@ -239,17 +239,18 @@ function groups_update_group_icon($group, $data, $editform) {
$context = get_context_instance(CONTEXT_COURSE, $group->courseid, MUST_EXIST);
//TODO: it would make sense to allow picture deleting too (skodak)
-
- if ($iconfile = $editform->save_temp_file('imagefile')) {
- if (process_new_icon($context, 'group', 'icon', $group->id, $iconfile)) {
- $DB->set_field('groups', 'picture', 1, array('id'=>$group->id));
- $group->picture = 1;
- } else {
- $fs->delete_area_files($context->id, 'group', 'icon', $group->id);
- $DB->set_field('groups', 'picture', 0, array('id'=>$group->id));
- $group->picture = 0;
+ if (!empty($CFG->gdversion)) {
+ if ($iconfile = $editform->save_temp_file('imagefile')) {
+ if (process_new_icon($context, 'group', 'icon', $group->id, $iconfile)) {
+ $DB->set_field('groups', 'picture', 1, array('id'=>$group->id));
+ $group->picture = 1;
+ } else {
+ $fs->delete_area_files($context->id, 'group', 'icon', $group->id);
+ $DB->set_field('groups', 'picture', 0, array('id'=>$group->id));
+ $group->picture = 0;
+ }
+ @unlink($iconfile);
}
- @unlink($iconfile);
}
}

0 comments on commit 40755f9

Please sign in to comment.
Something went wrong with that request. Please try again.