From d44cc86af0f1010b8240d0d65f94623d00007261 Mon Sep 17 00:00:00 2001 From: Avinash Rajesh Date: Mon, 15 Jun 2026 14:43:48 +0530 Subject: [PATCH] Implement the review fixes --- .../services/AuthenticationManagementService.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/services/AuthenticationManagementService.cpp b/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/services/AuthenticationManagementService.cpp index 27be89f..71d66b6 100644 --- a/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/services/AuthenticationManagementService.cpp +++ b/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/services/AuthenticationManagementService.cpp @@ -79,15 +79,15 @@ void AuthenticationManagementService::changePassword(const std::string& newPassw { DataStoreLockGuard lock(m_dataStore); auto& trackedUsersMap = m_dataStore.getUsers(); + if (m_authenticatedUser == nullptr) + { + throw std::runtime_error("There is no user currently logged in!"); + } int index = trackedUsersMap.find(m_authenticatedUser->getId()); if (index == -1) { throw std::runtime_error("User does not exist!\n"); } - if (m_authenticatedUser == nullptr) - { - throw std::runtime_error("There is no user currently logged in!"); - } m_authenticatedUser->setPassword(newPassword); trackedUsersMap.getValueAt(index).state = RecordState::MODIFIED; m_dataStore.saveUsers();