mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 20:11:17 +00:00
Make str_eq safe to use with NULL.
This commit is contained in:
@@ -118,7 +118,7 @@ bool str_is_identifier(const char *string)
|
||||
|
||||
bool str_eq(const char *str1, const char *str2)
|
||||
{
|
||||
return str1 == str2 || strcmp(str1, str2) == 0;
|
||||
return str1 == str2 || (str1 && str2 && strcmp(str1, str2) == 0);
|
||||
}
|
||||
|
||||
bool str_is_integer(const char *string)
|
||||
|
||||
Reference in New Issue
Block a user