diff options
author | Nullspoon <nullspoon@iohq.net> | 2014-09-25 22:52:10 -0600 |
---|---|---|
committer | Nullspoon <nullspoon@iohq.net> | 2014-09-25 22:52:10 -0600 |
commit | 296964fac1f787422a1d13e70a01c4a9d78e1805 (patch) | |
tree | aad985d339ebb3a05ec41244dae2881083ac29b3 | |
parent | acdfcfcdac2794793f8dd045f8c9b26cb0bf0356 (diff) | |
download | noteless-296964fac1f787422a1d13e70a01c4a9d78e1805.tar.gz noteless-296964fac1f787422a1d13e70a01c4a9d78e1805.tar.xz |
Fixed out of bound exception on no arguments
When checking for the first argument being init, we assumed that there was a
first argument. Now checks for argument count being greater than 0 and prints
the help text if it is not.
-rw-r--r-- | src/main.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/main.cpp b/src/main.cpp index aee94e3..cfc5dd7 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -129,6 +129,11 @@ int main( int argc, char** argv ) { } } + if( argc == 1 ) { + cout << "\nNo command specified. Printing help text.\n" << endl; + return get_help(); + } + // If the init command was passed, we want to init before checking if the // note path exists, otherwise the error will display and the store will // never be initialized. |