From 1b012b0f46583fe8b94d721ddf3560c89a37cafc Mon Sep 17 00:00:00 2001 From: Matt McCormick Date: Sun, 9 Jun 2013 20:58:47 -0400 Subject: [PATCH] Output error on graph_lines < 1. Issue #3. --- tmux-mem-cpu-load.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tmux-mem-cpu-load.cpp b/tmux-mem-cpu-load.cpp index 501ae64..93ae588 100644 --- a/tmux-mem-cpu-load.cpp +++ b/tmux-mem-cpu-load.cpp @@ -358,7 +358,7 @@ std::string load_string( bool use_colors ) int main(int argc, char** argv) { unsigned int cpu_usage_delay = 900000; - unsigned int graph_lines = 10; + int graph_lines = 10; bool use_colors = false; try { @@ -387,6 +387,11 @@ int main(int argc, char** argv) iss.str( argv[arg_index] ); iss.clear(); iss >> graph_lines; + if( graph_lines < 1 ) + { + std::cerr << "graph lines argument must be one or greater." << std::endl; + return 1; + } } } catch(const std::exception &e)