BLI: avoid warning when copying empty StringRef

This commit is contained in:
Jacques Lucke 2021-09-22 19:45:18 +02:00
parent 188de4bc31
commit a28ec92088
1 changed files with 3 additions and 1 deletions

View File

@ -134,7 +134,9 @@ class StringRefBase {
*/
void unsafe_copy(char *dst) const
{
memcpy(dst, data_, static_cast<size_t>(size_));
if (size_ > 0) {
memcpy(dst, data_, static_cast<size_t>(size_));
}
dst[size_] = '\0';
}