GpuService: handle null shell command
Test: for cmd in "" help vkjson foo; do adb shell cmd gpu $cmd; done
Bug: 33747292
Change-Id: Iaed396cc5157e17bf72b53566fb3e38c64182c44
diff --git a/services/surfaceflinger/GpuService.cpp b/services/surfaceflinger/GpuService.cpp
index b993dfb..dc1d3f0 100644
--- a/services/surfaceflinger/GpuService.cpp
+++ b/services/surfaceflinger/GpuService.cpp
@@ -71,12 +71,15 @@
for (size_t i = 0, n = args.size(); i < n; i++)
ALOGV(" arg[%zu]: '%s'", i, String8(args[i]).string());
- if (args[0] == String16("vkjson"))
- return cmd_vkjson(out, err);
- else if (args[0] == String16("help"))
- return cmd_help(out);
-
- return NO_ERROR;
+ if (args.size() >= 1) {
+ if (args[0] == String16("vkjson"))
+ return cmd_vkjson(out, err);
+ if (args[0] == String16("help"))
+ return cmd_help(out);
+ }
+ // no command, or unrecognized command
+ cmd_help(err);
+ return BAD_VALUE;
}
// ----------------------------------------------------------------------------