Skip to content

Commit

Permalink
fix: clientList vector reserve
Browse files Browse the repository at this point in the history
  • Loading branch information
gikari committed Mar 27, 2022
1 parent a3686eb commit 0601f99
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/core/plasma-api/workspace.cpp
Expand Up @@ -66,9 +66,12 @@ std::vector<PlasmaApi::Client> Workspace::clientList() const

auto apiCallRes = apiCall();

auto result = std::vector<PlasmaApi::Client>(apiCallRes.size());
auto result = std::vector<PlasmaApi::Client>();
result.reserve(apiCallRes.size());
for (auto clientPtr : apiCallRes) {
result.push_back(Client(reinterpret_cast<QObject *>(clientPtr)));
if (clientPtr) {
result.push_back(Client(reinterpret_cast<QObject *>(clientPtr)));
}
}

return result;
Expand Down

0 comments on commit 0601f99

Please sign in to comment.