diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2024-05-06 19:27:56 +0200 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2024-05-06 19:27:56 +0200 |
commit | 2607c3a96f39a8483d3b72b8018e162f7d581c64 (patch) | |
tree | c30cf6ee167bd7b40c6a8bc3b29f0f66f7d04e09 /editor | |
parent | 98b6f14c8c27898da75a8c556b9c240c388ba6dc (diff) |
fix stale reference in editor::update()
It also reduces the amount of Corrade asserts by calling `.data()` and
`.get()` rather than `.operator[]` and `.operator*`.
Diffstat (limited to 'editor')
-rw-r--r-- | editor/update.cpp | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/editor/update.cpp b/editor/update.cpp index 52c84d4d..204248c5 100644 --- a/editor/update.cpp +++ b/editor/update.cpp @@ -241,13 +241,12 @@ void app::update_world(Ns dt) auto size = (uint32_t)c.objects().size(); for (auto i = 0u; i < size; i++) { - auto& eʹ = c.objects().data()[i]; auto index = size_t{i}; - auto& e = *eʹ; + auto& e = *c.objects().data()[i].get(); if (e.last_frame_no == frame_no) [[unlikely]] continue; e.last_frame_no = frame_no; - e.update(eʹ, index, dt); // objects can't delete themselves during update() + e.update(c.objects().data()[i], index, dt); // objects can't delete themselves during update() if (&e.chunk() != cʹ || index > i) [[unlikely]] { i--; |