mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-04-25 13:03:50 +00:00
fix: unguarded future::get() crashed on render/floor-query worker exceptions
std::future::get() re-throws any exception from the async task. The 6 call sites in the render pipeline (terrain/WMO/M2 workers + animation worker) and 2 floor-query sites in camera_controller were unguarded, so a single bad_alloc in any worker would terminate the process with no recovery. Now wrapped in try-catch with error logging.
This commit is contained in:
parent
74cc048767
commit
3dd1128ecf
2 changed files with 20 additions and 12 deletions
|
|
@ -1033,16 +1033,17 @@ void CameraController::update(float deltaTime) {
|
|||
terrainH = terrainManager->getHeightAt(targetPos.x, targetPos.y);
|
||||
}
|
||||
if (wmoAsync) {
|
||||
auto [h, nz] = wmoFuture.get();
|
||||
wmoH = h;
|
||||
wmoNormalZ = nz;
|
||||
try { auto [h, nz] = wmoFuture.get(); wmoH = h; wmoNormalZ = nz; }
|
||||
catch (const std::exception& e) { LOG_ERROR("WMO floor query: ", e.what()); }
|
||||
}
|
||||
if (m2Async) {
|
||||
auto [h, nz] = m2Future.get();
|
||||
m2H = h;
|
||||
if (m2H && nz < MIN_WALKABLE_NORMAL_M2) {
|
||||
m2H = std::nullopt;
|
||||
}
|
||||
try {
|
||||
auto [h, nz] = m2Future.get();
|
||||
m2H = h;
|
||||
if (m2H && nz < MIN_WALKABLE_NORMAL_M2) {
|
||||
m2H = std::nullopt;
|
||||
}
|
||||
} catch (const std::exception& e) { LOG_ERROR("M2 floor query: ", e.what()); }
|
||||
}
|
||||
|
||||
// Reject steep WMO slopes
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue