Skip to content

Commit

Permalink
Fix: return empty localized_string object instead of null when langua…
Browse files Browse the repository at this point in the history
…ge is not available.
  • Loading branch information
srobotta committed Jan 24, 2025
1 parent bbd48eb commit ee34733
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions classes/model/report_criterion.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,9 @@ public function get_descriptions(): array {
* Gets a localized criterion description for the given language string.
*
* @param string $languagestr The given language string
* @return \mod_verbalfeedback\model\localized_string|null
* @return \mod_verbalfeedback\model\localized_string
*/
public function get_description(string $languagestr): ?localized_string {
public function get_description(string $languagestr): localized_string {
$languagerepository = new language_repository();

// Select the language string matching the current language.
Expand All @@ -98,7 +98,7 @@ public function get_description(string $languagestr): ?localized_string {
return $localizedstring;
}
}
return null;
return new localized_string(0, 0);
}

/**
Expand Down

0 comments on commit ee34733

Please sign in to comment.