diff --git a/Settings.c b/Settings.c index 817fbc15a8a296df8bfb9b65c6b50281788c1a25..a7f20ebb84e456f3b93949ebe22330018585b888 100644 --- a/Settings.c +++ b/Settings.c @@ -216,6 +216,9 @@ static void Settings_defaultMeters(Settings* this) { } static const char* toFieldName(int i) { + if (i < 0 || i > LAST_PROCESSFIELD) { + return ""; + } return Process_fields[i].name; } @@ -275,7 +278,7 @@ static void Settings_defaultScreens(Settings* this) { for (unsigned int i = 0; i < Platform_numberOfDefaultScreens; i++) { ScreenDefaults* defaults = &Platform_defaultScreens[i]; Settings_newScreen(this, defaults->name, defaults->columns); - this->screens[0]->sortKey = toFieldIndex(defaults->sortKey); + this->screens[i]->sortKey = toFieldIndex(defaults->sortKey); } } diff --git a/linux/Platform.c b/linux/Platform.c index 7efc7e4787dfd90165cda6f564dcd6cf8c32757f..cfaa0f149c991771a8f7a7de703d0084a9471f41 100644 --- a/linux/Platform.c +++ b/linux/Platform.c @@ -101,7 +101,7 @@ ScreenDefaults Platform_defaultScreens[] = { { .name = "L1 Data Cache", .columns = "PID USER PERCENT_CPU L1DREADS L1DRMISSES L1DWRITES L1DWMISSES Command", - .sortKey = "LD1READS", + .sortKey = "L1DREADS", }, };