changeset 1763:29c85a2c6df0

fix segfault in sample rt viewer on sdl
author Sebastien Jodogne <s.jodogne@gmail.com>
date Mon, 10 May 2021 14:18:24 +0200
parents 604fc328dc10
children adb59bcb0fc5
files OrthancStone/Sources/Volumes/VolumeSceneLayerSource.cpp
diffstat 1 files changed, 6 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/OrthancStone/Sources/Volumes/VolumeSceneLayerSource.cpp	Mon May 10 11:56:47 2021 +0200
+++ b/OrthancStone/Sources/Volumes/VolumeSceneLayerSource.cpp	Mon May 10 14:18:24 2021 +0200
@@ -44,9 +44,12 @@
   {
     {
       std::unique_ptr<IViewport::ILock> lock(GetViewportLock());
-      ViewportController& controller = lock->GetController();
-      Scene2D& scene = controller.GetScene();
-      scene.DeleteLayer(layerDepth_);
+      if (lock.get())
+      {
+        ViewportController& controller = lock->GetController();
+        Scene2D& scene = controller.GetScene();
+        scene.DeleteLayer(layerDepth_);
+      }
     }
     lastPlane_.reset(NULL);
   }