process: make sure we don't read past GTop.get_proc_argv's return value's length

If a process doesn't have any arguments passed to it its argv will only
have a size of 1 - its own name

fixes #80
parent 9f1a9b3c
Pipeline #213288 passed with stages
in 20 minutes and 2 seconds
......@@ -106,7 +106,7 @@ namespace Usage
/* cmd is most likely a truncated version, therefore
* we check the first two arguments of the full argv
* vector if they match cmd and if so, use that */
for (int i = 0; i < 2; i++) {
for (int i = 0; i < (args.length > 1 ? 2 : args.length); i++) {
if (args[i] == null)
continue;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment