Commit b7f69238 authored by topjohnwu's avatar topjohnwu

Fix segfault on several devices

parent 118a9f22
...@@ -16,8 +16,8 @@ ...@@ -16,8 +16,8 @@
#include <string> #include <string>
#include <vector> #include <vector>
#define str_contains(s, ss) ((s).find(ss) != string::npos) #define str_contains(s, ss) ((ss) != nullptr && (s).find(ss) != string::npos)
#define str_starts(s, ss) ((s).compare(0, strlen(ss), ss) == 0) #define str_starts(s, ss) ((ss) != nullptr && (s).compare(0, strlen(ss), ss) == 0)
std::vector<std::string> file_to_vector(const char *filename); std::vector<std::string> file_to_vector(const char *filename);
char *strdup2(const char *s, size_t *size = nullptr); char *strdup2(const char *s, size_t *size = nullptr);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment