aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorlogin000 <34250284+login000@users.noreply.github.com>2019-07-15 20:10:23 +1000
committerGitHub <noreply@github.com>2019-07-15 20:10:23 +1000
commit6a7afee933ca2edf6a1ba213300afbb66303a57e (patch)
tree8c71a9303d9b0529b873ca340243793a7d9e49e8
parentd7db0da8b714d560123e7a83b8bd1b56f3f35129 (diff)
downloadtcoin-6a7afee933ca2edf6a1ba213300afbb66303a57e.tar.gz
Fixed bug in "tcoin init" and "tcoin"
Fixed bug in "tcoin init" and "tcoin" when an uninitialised user runs them. Previously, it used to display the following error: Error! Could not open file at <file_path>! Assuming its internal content is "0\n" because 'user_amount' in 'int main()' was read from the file before checking if the user had initialised.
-rw-r--r--tcoin.cpp3
1 files changed, 1 insertions, 2 deletions
diff --git a/tcoin.cpp b/tcoin.cpp
index 8085950..5aad518 100644
--- a/tcoin.cpp
+++ b/tcoin.cpp
@@ -1516,8 +1516,6 @@ int main(int argc, char *argv[])
//is the unit used throughout the program (and converted appropriately when displayed)
}
- user_amount = get_file_value(get_username().c_str());
-
srand((long int)(std::time(NULL)) + strtol_fast(exec(BIN_ECHO_CMD).c_str()));
if(argc > 1 && (!strcmp(argv[1], "--help") || !strcmp(argv[1], "help") || !strcmp(argv[1], "-h")))
@@ -1549,6 +1547,7 @@ int main(int argc, char *argv[])
return 5;
}
+ user_amount = get_file_value(get_username().c_str());
long long int total_amount = base_amount + user_amount;
if(argc < 2)