From a7738e56cb130628bfd5295a0b25853c6f29da24 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mattias=20Sch=C3=A4ffersmann?= Date: Thu, 17 Oct 2024 14:42:42 +0200 Subject: [PATCH] system: Use size_t when iterating over ConfArray Also get users config only once. --- software/src/modules/system/system.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/software/src/modules/system/system.cpp b/software/src/modules/system/system.cpp index f9d83aec6..cb1c4003a 100644 --- a/software/src/modules/system/system.cpp +++ b/software/src/modules/system/system.cpp @@ -110,8 +110,9 @@ void System::register_urls() #endif #if MODULE_USERS_AVAILABLE() && MODULE_CHARGE_TRACKER_AVAILABLE() - for(int i = 0; i < users.config.get("users")->count(); ++i) { - uint8_t id = users.config.get("users")->get(i)->get("id")->asUint(); + Config *config_users = static_cast(users.config.get("users")); + for (size_t i = 0; i < config_users->count(); ++i) { + uint8_t id = config_users->get(i)->get("id")->asUint(); if (id == 0) // skip anonymous user continue; if (!charge_tracker.is_user_tracked(id)) {