mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Fix bug in for loop that can lead to segfault
In case of big log files, where MAX_TANK_INFO is reached, tank_info[i] != NULL should be checked after i<MAX_TANK_INFO Signed-off-by: Simeon Geiger <simeon.geiger@gmail.com>
This commit is contained in:
parent
bb4c2031ef
commit
8cf8d490d6
1 changed files with 1 additions and 1 deletions
|
@ -84,7 +84,7 @@ void PreferencesDefaults::refreshSettings()
|
|||
ui->localDefaultFile->setChecked(qPrefGeneral::default_file_behavior() == LOCAL_DEFAULT_FILE);
|
||||
|
||||
ui->default_cylinder->clear();
|
||||
for (int i = 0; tank_info[i].name != NULL && i < MAX_TANK_INFO; i++) {
|
||||
for (int i = 0; i < MAX_TANK_INFO && tank_info[i].name != NULL; i++) {
|
||||
ui->default_cylinder->addItem(tank_info[i].name);
|
||||
if (qPrefGeneral::default_cylinder() == tank_info[i].name)
|
||||
ui->default_cylinder->setCurrentIndex(i);
|
||||
|
|
Loading…
Add table
Reference in a new issue