diff --git a/native/jni/utils/include/utils.h b/native/jni/utils/include/utils.h index c97c12919..038decbf0 100644 --- a/native/jni/utils/include/utils.h +++ b/native/jni/utils/include/utils.h @@ -16,8 +16,8 @@ #include #include -#define str_contains(s, ss) ((s).find(ss) != string::npos) -#define str_starts(s, ss) ((s).compare(0, strlen(ss), ss) == 0) +#define str_contains(s, ss) ((ss) != nullptr && (s).find(ss) != string::npos) +#define str_starts(s, ss) ((ss) != nullptr && (s).compare(0, strlen(ss), ss) == 0) std::vector file_to_vector(const char *filename); char *strdup2(const char *s, size_t *size = nullptr);