BLI: avoid passing nullptr to strncmp

This resulted in an ASAN warning.
This commit is contained in:
Jacques Lucke 2021-11-02 15:07:35 +01:00
parent efcf36f2e9
commit 698b05fc58
1 changed files with 4 additions and 0 deletions

View File

@ -610,6 +610,10 @@ constexpr bool operator==(StringRef a, StringRef b)
if (a.size() != b.size()) {
return false;
}
if (a.data() == b.data()) {
/* This also avoids passing null to the call below, which would results in an ASAN warning. */
return true;
}
return STREQLEN(a.data(), b.data(), (size_t)a.size());
}