Skip to content

Commit 851e992

Browse files
committed
fix TU
1 parent d023409 commit 851e992

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

inc/question.class.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -402,7 +402,9 @@ private function checkBeforeSave($input) : array {
402402
* @return array the modified $input array
403403
*/
404404
public function prepareInputForAdd($input) {
405-
$input['default_values'] = str_replace('\r\n', '', $input['default_values']);
405+
if (!empty($input['default_values'])) {
406+
$input['default_values'] = str_replace('\r\n', '', $input['default_values']);
407+
}
406408

407409
if (!$this->skipChecks) {
408410
$input = $this->checkBeforeSave($input);
@@ -454,7 +456,9 @@ public function prepareInputForAdd($input) {
454456
public function prepareInputForUpdate($input) {
455457
// global $DB;
456458

457-
$input['default_values'] = str_replace('\r\n', '', $input['default_values']);
459+
if (!empty($input['default_values'])) {
460+
$input['default_values'] = str_replace('\r\n', '', $input['default_values']);
461+
}
458462
if (!$this->skipChecks) {
459463
if (!isset($input['plugin_formcreator_sections_id'])) {
460464
$input['plugin_formcreator_sections_id'] = $this->fields['plugin_formcreator_sections_id'];

0 commit comments

Comments
 (0)