From: Elena Mamontova <helenh463@gmail.com>
Date: Mon, 9 Nov 2015 16:02:41 +0000 (+0200)
Subject: Ticket 12. The if (settings->GetStopOnError()) check and displays
X-Git-Url: https://git.stg.codes/stg.git/commitdiff_plain/cd22a6554a8c6d917306304aeaf5d2b7a9d99ae4?ds=sidebyside

Ticket 12. The if (settings->GetStopOnError()) check and displays
error users in depending on the result added in the ReadUsers() method.
---

diff --git a/projects/stargazer/users_impl.cpp b/projects/stargazer/users_impl.cpp
index 14c44604..70a079bf 100644
--- a/projects/stargazer/users_impl.cpp
+++ b/projects/stargazer/users_impl.cpp
@@ -355,11 +355,21 @@ for (unsigned int i = 0; i < usersList.size(); i++)
 
     AddUserIntoIndexes(ui);
 
-    if (ui->ReadConf() < 0)
-        errors++;
-
-    if (ui->ReadStat() < 0)
-        errors++;
+    if (settings->GetStopOnError())
+        {
+        if (ui->ReadConf() < 0)
+            return -1;
+
+        if (ui->ReadStat() < 0)
+            return -1;
+        } else
+                {
+                if (ui->ReadConf() < 0)
+                    errors++;
+
+                if (ui->ReadStat() < 0)
+                    errors++;
+                }
     }
 
 if (errors > 0)