Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJacques Lucke <jacques@blender.org>2021-09-22 20:45:18 +0300
committerJacques Lucke <jacques@blender.org>2021-09-22 20:45:18 +0300
commita28ec920884c63fbef72cf5af75cd446744009ca (patch)
tree698405fd3b11e79efcd19e29bfcac7b1fe26128a /source/blender/blenlib
parent188de4bc31427c4883b87beea83126b42a628798 (diff)
BLI: avoid warning when copying empty StringRef
Diffstat (limited to 'source/blender/blenlib')
-rw-r--r--source/blender/blenlib/BLI_string_ref.hh4
1 files changed, 3 insertions, 1 deletions
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_t>(size_));
+ if (size_ > 0) {
+ memcpy(dst, data_, static_cast<size_t>(size_));
+ }
dst[size_] = '\0';
}