From 8bf9fddade0fa5a5df7dbc4e9755f8a4950e973a Mon Sep 17 00:00:00 2001 From: "U-SOPHIE\\yohan" Date: Mon, 8 Apr 2024 23:29:17 +0700 Subject: [PATCH] handle null string --- app/src/main/cpp/native-lib.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/src/main/cpp/native-lib.cpp b/app/src/main/cpp/native-lib.cpp index db3ba02..0705985 100644 --- a/app/src/main/cpp/native-lib.cpp +++ b/app/src/main/cpp/native-lib.cpp @@ -25,7 +25,10 @@ void *my_dlopen(const char *filename, int flags) } static void send_string(int fd, const char *str) { - int len = strlen(str); + int len = 0; + if (str) { + len = strlen(str); + } write(fd, &len, sizeof(len)); write(fd, str, len); }