@@ -254,6 +254,7 @@ struct RecenterGuard {
254254 try {
255255 restoreEntitiesFromRecenter (entities, offset);
256256 } catch (...) {
257+ // Best-effort restore; swallow to keep destructor noexcept.
257258 }
258259 }
259260};
@@ -449,7 +450,10 @@ bool captureIsometricGrid(const Ogre::AxisAlignedBox &bounds, const IsometricOpt
449450 : animLength * static_cast <float >(frame) / static_cast <float >(frames - 1 );
450451 applyAnimationFrame (animatedEntity, animState, t);
451452 }
452- state ().renderTarget ->update ();
453+ Ogre::RenderTarget *renderTarget = state ().renderTarget ;
454+ if (!renderTarget)
455+ return false ;
456+ renderTarget->update ();
453457 row.append (readRenderTarget (width, height));
454458 }
455459 outRowsByDirection->append (row);
@@ -619,9 +623,15 @@ bool ModelIsometricRenderer::renderToGrid(const QList<Ogre::Entity *> &entities,
619623
620624 outRowsByDirection->reserve (directions);
621625 try {
622- captureIsometricGrid (bounds, options, width, height, directions, frames, elevationRad, startAzimuthRad,
623- directionStep, wantsAnimation, animatedEntity, animState, animLength,
624- outRowsByDirection);
626+ if (!captureIsometricGrid (bounds, options, width, height, directions, frames, elevationRad, startAzimuthRad,
627+ directionStep, wantsAnimation, animatedEntity, animState, animLength,
628+ outRowsByDirection)) {
629+ outRowsByDirection->clear ();
630+ restoreIsometricLighting (sm);
631+ if (errorOut)
632+ *errorOut = QStringLiteral (" Isometric render target is not available" );
633+ return false ;
634+ }
625635
626636 if (wantsAnimation && animState)
627637 animState->setEnabled (false );
0 commit comments