diff options
| author | Yao Chen <yaochen@google.com> | 2018-11-29 09:39:45 -0800 |
|---|---|---|
| committer | Yao Chen <yaochen@google.com> | 2018-11-29 10:59:57 -0800 |
| commit | 8e6f9983009eadf32d05ad65e38906d3985bc9ba (patch) | |
| tree | 347aee3288ccf837ddb4f8edb6eb1217c4af1dd4 /tools/stats_log_api_gen/main.cpp | |
| parent | d8a9db84862b7f9a8d2dc50373e7642b818862f4 (diff) | |
Skip writing message field in an atom if it's empty
Test: unit test added
Change-Id: I825b1ce526944a20fe65705508ad180ece37492c
Diffstat (limited to 'tools/stats_log_api_gen/main.cpp')
| -rw-r--r-- | tools/stats_log_api_gen/main.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/tools/stats_log_api_gen/main.cpp b/tools/stats_log_api_gen/main.cpp index 8585ae9f3f61..88b7e2e9de21 100644 --- a/tools/stats_log_api_gen/main.cpp +++ b/tools/stats_log_api_gen/main.cpp @@ -1128,7 +1128,10 @@ write_stats_log_jni(FILE* out, const string& java_method_name, const string& cpp hadStringOrChain = true; fprintf(out, " jbyte* jbyte_array%d;\n", argIndex); fprintf(out, " const char* str%d;\n", argIndex); - fprintf(out, " if (arg%d != NULL) {\n", argIndex); + fprintf(out, + " if (arg%d != NULL && env->GetArrayLength(arg%d) > " + "0) {\n", + argIndex, argIndex); fprintf(out, " jbyte_array%d = " "env->GetByteArrayElements(arg%d, NULL);\n", |
