summaryrefslogtreecommitdiff
path: root/tools/stats_log_api_gen/main.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tools/stats_log_api_gen/main.cpp')
-rw-r--r--tools/stats_log_api_gen/main.cpp5
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",