diff options
| author | login <login@tilde.team> | 2022-05-14 20:04:32 +0000 |
|---|---|---|
| committer | login <login@tilde.team> | 2022-05-14 20:04:32 +0000 |
| commit | cad83e8167ce6dd68f2ac47750de5248b568177e (patch) | |
| tree | 60dd5b337c977b6ac00650ee1de197fd7453c302 | |
| parent | 82d02462de2fc66ec639beef177e8532b2473284 (diff) | |
| download | tcoin-cad83e8167ce6dd68f2ac47750de5248b568177e.tar.gz | |
Checking for empty key in pcoin
pcoin now checks if an empty key was entered, and sends a different error message and error code for empty key as compared to incorrect key.
| -rw-r--r-- | pcoin.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
@@ -86,6 +86,7 @@ #define ERR_SEND_MESSAGE_SENDER_MSG_FILE_UNABLE_TO_BE_UPDATED_FATAL 102 #define ERR_SEND_MESSAGE_SENDER_PROGRAM_MSG_FILE_UNABLE_TO_BE_UPDATED_FATAL 104 +#define ERR_KEY_EMPTY 22 #define ERR_KEY_NOT_IN_USE 9 #define ERR_NO_ARGS 8 #define ERR_IN_MAIN_GET_INTERNAL_TOTAL_OWED_FAILED 18 @@ -1825,6 +1826,12 @@ int main(int argc, char *argv[]) std::string program_username; std::getline(std::cin, key); + if(!key.compare("")) + { + std::cout << "\nSorry, you incorrectly specified an empty key.\n\n"; + return ERR_KEY_EMPTY; + } + program_username.assign(get_username_from_key(key)); if(!program_username.compare("n/a")) |