summaryrefslogtreecommitdiff
path: root/servers
diff options
context:
space:
mode:
authorHaoyu Qiu <timothyqiu32@gmail.com>2021-09-29 20:54:43 +0800
committerHaoyu Qiu <timothyqiu32@gmail.com>2021-09-29 20:58:14 +0800
commit9dd0d3f550a0940dd53833666cd082e81aab8eff (patch)
tree8fc7a7d680e2f223a164c478c06685927309e592 /servers
parent4c1d2e935061a99884fffc6a84f8fbf279387691 (diff)
Don't memcpy to nullptr even if length is zero
Diffstat (limited to 'servers')
-rw-r--r--servers/physics_3d/soft_body_3d_sw.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/servers/physics_3d/soft_body_3d_sw.cpp b/servers/physics_3d/soft_body_3d_sw.cpp
index 5f6e202c73..752d5f3a91 100644
--- a/servers/physics_3d/soft_body_3d_sw.cpp
+++ b/servers/physics_3d/soft_body_3d_sw.cpp
@@ -249,8 +249,10 @@ void SoftBody3DSW::update_area() {
// Node area.
LocalVector<int> counts;
- counts.resize(nodes.size());
- memset(counts.ptr(), 0, counts.size() * sizeof(int));
+ if (nodes.size() > 0) {
+ counts.resize(nodes.size());
+ memset(counts.ptr(), 0, counts.size() * sizeof(int));
+ }
for (i = 0, ni = nodes.size(); i < ni; ++i) {
nodes[i].area = 0.0;