summaryrefslogtreecommitdiffstats
path: root/src/corelib/tools/qarraydataops.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/corelib/tools/qarraydataops.h')
-rw-r--r--src/corelib/tools/qarraydataops.h3
1 files changed, 1 insertions, 2 deletions
diff --git a/src/corelib/tools/qarraydataops.h b/src/corelib/tools/qarraydataops.h
index edfcd827061..03ba93198c0 100644
--- a/src/corelib/tools/qarraydataops.h
+++ b/src/corelib/tools/qarraydataops.h
@@ -460,8 +460,7 @@ public:
const bool grows = options & (Data::GrowsForward | Data::GrowsBackwards);
// ### optimize me: there may be cases when moving is not obligatory
- if (this->d && !grows) {
- const auto gap = this->freeSpaceAtBegin();
+ if (const auto gap = this->freeSpaceAtBegin(); this->d && !grows && gap) {
auto oldBegin = this->begin();
this->ptr -= gap;
::memmove(static_cast<void *>(this->begin()), static_cast<void *>(oldBegin),