Skip to content

Commit

Permalink
avoid null object possiblity
Browse files Browse the repository at this point in the history
  • Loading branch information
dionysius committed Aug 29, 2019
1 parent 0f1557e commit 9959f08
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions classes/question/bank/question_bank_filter.php
Original file line number Diff line number Diff line change
Expand Up @@ -157,14 +157,13 @@ public function setupForm(&$mform) {
if (!empty($group) && !($group instanceof HTML_QuickForm_Error)) {
$groupelements = $group->getElements();
if (!empty($groupelements)) {
$dateelement = null;
$dateselector = array();
foreach ($groupelements as $el) {
if ($el instanceof MoodleQuickForm_date_selector) {
$dateelement = $el;
$dateselector = $el->getElements();
break;
}
}
$dateselector = $dateelement->getElements();
if (!empty($dateselector)) {
$isbefore = optional_param('timecreated_sdt', 0, PARAM_INT);
if ($isbefore && $isbefore['enabled']) {
Expand Down

0 comments on commit 9959f08

Please sign in to comment.