Skip to content

Commit

Permalink
fix: prevent warning when creating new questions by adding a null check
Browse files Browse the repository at this point in the history
Kanbanize: #taskid 51492
  • Loading branch information
Pol Torrent i Soler committed Nov 4, 2024
1 parent 4d3d157 commit f42c7c0
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions edit_multianswerwiris_form.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,12 @@ class qtype_multianswer_edit_form_helper extends qtype_multianswer_edit_form {
protected function definition_inner($mform) {
// Remove wiris particle from subquestion qtypes so the multianswer form does not think
// we are changing the qtypes when we are not actually doing it.
foreach ($this->savedquestiondisplay->options->questions as $subq) {
$qtype = $subq->qtype;
if (substr($qtype, -5) == 'wiris') {
$subq->qtype = substr($qtype, 0, strlen($qtype) - 5);
if (isset($this->savedquestiondisplay)) {
foreach ($this->savedquestiondisplay->options->questions as $subq) {
$qtype = $subq->qtype;
if (substr($qtype, -5) == 'wiris') {
$subq->qtype = substr($qtype, 0, strlen($qtype) - 5);
}
}
}

Expand Down

0 comments on commit f42c7c0

Please sign in to comment.