diff --git a/source/blender/blenlib/BLI_string_ref.hh b/source/blender/blenlib/BLI_string_ref.hh index 6ad4d6fd3af..4f6f2cbfa41 100644 --- a/source/blender/blenlib/BLI_string_ref.hh +++ b/source/blender/blenlib/BLI_string_ref.hh @@ -612,9 +612,13 @@ constexpr bool operator==(StringRef a, StringRef b) * which would results in an ASAN warning. */ return true; } - if (!a.data() || !b.data()) { - /* Account for a single value being null, resulting in an ASAN warning. */ - return false; + /* Account for a single value being null, resulting in an ASAN warning. + * Ensure an empty string is equal to a string with a null pointer. */ + if (!a.data()) { + return *b.data() == '\0'; + } + if (!b.data()) { + return *a.data() == '\0'; } return STREQLEN(a.data(), b.data(), size_t(a.size())); }