fix(legacy): avoid crash when lot of streams in configuration ()

### Description

lot of streams forbid
http://libretime.example.org/preference/stream-setting to open (max=4)
this patch prevent the crash by displaying an error message and truncate
streamcount to 4.

Co-authored-by: Kyle Robbertze <paddatrapper@users.noreply.github.com>
This commit is contained in:
Julien Valentin 2024-01-30 18:24:28 +01:00 committed by GitHub
parent f6d7be9b1c
commit 12dd477312
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 5 additions and 0 deletions
legacy/application/controllers

View File

@ -156,6 +156,11 @@ class PreferenceController extends Zend_Controller_Action
$setting = Application_Model_StreamSetting::getStreamSetting();
$form->setSetting($setting);
if ($num_of_stream > MAX_NUM_STREAMS) {
Logging::error('Your streams count (' . $num_of_stream . ') exceed the maximum, some of them will not be displayed');
$num_of_stream = MAX_NUM_STREAMS;
}
for ($i = 1; $i <= $num_of_stream; ++$i) {
$subform = new Application_Form_StreamSettingSubForm();
$subform->setPrefix($i);