Update Settings_newScreen with single-line sortKey checking.

Co-authored-by: BenBE <BenBE@geshi.org>
This commit is contained in:
Nathan Scott 2022-05-01 16:21:13 +10:00 committed by GitHub
parent cde72dd0b0
commit 10b541b5e4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 5 deletions

View File

@ -271,11 +271,7 @@ static void ScreenSettings_readFields(ScreenSettings* ss, Hashtable* columns, co
ScreenSettings* Settings_newScreen(Settings* this, const ScreenDefaults* defaults) { ScreenSettings* Settings_newScreen(Settings* this, const ScreenDefaults* defaults) {
int sortKey = defaults->sortKey ? toFieldIndex(this->dynamicColumns, defaults->sortKey) : PID; int sortKey = defaults->sortKey ? toFieldIndex(this->dynamicColumns, defaults->sortKey) : PID;
int sortDesc; int sortDesc = (sortKey >= 0 && sortKey < LAST_PROCESSFIELD) ? Process_fields[sortKey].defaultSortDesc : 1;
if (sortKey >= 0 && sortKey < LAST_PROCESSFIELD)
sortDesc = Process_fields[sortKey].defaultSortDesc;
else
sortDesc = 1;
ScreenSettings* ss = xMalloc(sizeof(ScreenSettings)); ScreenSettings* ss = xMalloc(sizeof(ScreenSettings));
*ss = (ScreenSettings) { *ss = (ScreenSettings) {