diff options
author | 2016-12-20 14:31:28 -0800 | |
---|---|---|
committer | 2016-12-21 10:40:26 -0800 | |
commit | 3e26b1363ff8b39a472fc2d4fe9ee59ee818b977 (patch) | |
tree | 5ba5eb78d803e23e6e1478aeeb3e5210bbc7629e | |
parent | f4237c11d2daa4fdce728dc607b70563bdb8d7bb (diff) |
GpuService: handle null shell command
Test: for cmd in "" help vkjson foo; do adb shell cmd gpu $cmd; done
Bug: 33747292
Change-Id: Iaed396cc5157e17bf72b53566fb3e38c64182c44
-rw-r--r-- | services/surfaceflinger/GpuService.cpp | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/services/surfaceflinger/GpuService.cpp b/services/surfaceflinger/GpuService.cpp index b993dfbb46..dc1d3f06f5 100644 --- a/services/surfaceflinger/GpuService.cpp +++ b/services/surfaceflinger/GpuService.cpp @@ -71,12 +71,15 @@ status_t GpuService::shellCommand(int /*in*/, int out, int err, 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; } // ---------------------------------------------------------------------------- |