From 93917936019bc459f988a9d1684818797da78ad4 Mon Sep 17 00:00:00 2001
From: Joan Sola <jsola@iri.upc.edu>
Date: Fri, 28 Feb 2020 15:45:56 +0100
Subject: [PATCH] hotfix getStateBlock()

---
 src/capture/capture_base.cpp | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/capture/capture_base.cpp b/src/capture/capture_base.cpp
index dd4e84860..d566ba5ab 100644
--- a/src/capture/capture_base.cpp
+++ b/src/capture/capture_base.cpp
@@ -140,14 +140,14 @@ const std::string& CaptureBase::getStructure() const
 
 StateBlockPtr CaptureBase::getStateBlock(const std::string& _key) const
 {
-    if (getSensor())
+    if (getSensor() and getSensor()->getStateBlock(_key))
     {
-        if (getSensor()->getO() and getSensor()->isStateBlockDynamic(_key))
+        if (getSensor()->isStateBlockDynamic(_key))
             return HasStateBlocks::getStateBlock(_key);
         else
             return getSensor()->getStateBlock(_key);
     }
-    else // No sensor associated: assume sensor params are here
+    else // No sensor associated, or sensor without this state block: assume sensor params are here
         return HasStateBlocks::getStateBlock(_key);
 }
 
-- 
GitLab