From a28ec920884c63fbef72cf5af75cd446744009ca Mon Sep 17 00:00:00 2001 From: Jacques Lucke Date: Wed, 22 Sep 2021 19:45:18 +0200 Subject: BLI: avoid warning when copying empty StringRef --- source/blender/blenlib/BLI_string_ref.hh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'source/blender/blenlib') diff --git a/source/blender/blenlib/BLI_string_ref.hh b/source/blender/blenlib/BLI_string_ref.hh index 257a0ba143e..dcf66bbf5ad 100644 --- a/source/blender/blenlib/BLI_string_ref.hh +++ b/source/blender/blenlib/BLI_string_ref.hh @@ -134,7 +134,9 @@ class StringRefBase { */ void unsafe_copy(char *dst) const { - memcpy(dst, data_, static_cast(size_)); + if (size_ > 0) { + memcpy(dst, data_, static_cast(size_)); + } dst[size_] = '\0'; } -- cgit v1.2.3