diff --git a/lib/classes/output/choicelist.php b/lib/classes/output/choicelist.php index 65a47919a54..4edc60867de 100644 --- a/lib/classes/output/choicelist.php +++ b/lib/classes/output/choicelist.php @@ -121,7 +121,7 @@ class choicelist implements named_templatable, renderable { * @return string|null The value of the selected option. */ public function get_selected_value(): ?string { - if (empty($this->selected) && !$this->allowempty && !empty($this->options)) { + if (is_null($this->selected) && !$this->allowempty && !empty($this->options)) { return array_key_first($this->options); } return $this->selected; @@ -244,7 +244,7 @@ class choicelist implements named_templatable, renderable { * @return string */ public function get_selected_content(renderer_base $output): string { - if (empty($this->selected)) { + if (is_null($this->selected)) { return ''; } $option = $this->options[$this->selected];