From 1e46802c90ce1896e7d5c5c7339a5cb184d67008 Mon Sep 17 00:00:00 2001
From: Christoph Rettinger <christoph.rettinger@fau.de>
Date: Thu, 9 Nov 2017 19:11:26 +0100
Subject: [PATCH] Added further nullptr checks

---
 src/field/distributors/KernelDistributor.h                 | 1 +
 src/field/distributors/NearestNeighborDistributor.h        | 1 +
 src/field/interpolators/KernelFieldInterpolator.h          | 1 +
 src/field/interpolators/NearestNeighborFieldInterpolator.h | 1 +
 src/field/interpolators/TrilinearFieldInterpolator.h       | 1 +
 5 files changed, 5 insertions(+)

diff --git a/src/field/distributors/KernelDistributor.h b/src/field/distributors/KernelDistributor.h
index dd94e2b20..1aed2f2ea 100644
--- a/src/field/distributors/KernelDistributor.h
+++ b/src/field/distributors/KernelDistributor.h
@@ -78,6 +78,7 @@ public:
 
       WALBERLA_CHECK( !blockStorage_.expired() );
       auto blockStorage = blockStorage_.lock();
+      WALBERLA_CHECK_NOT_NULLPTR(blockStorage);
 
       Cell centerCell = blockStorage->getBlockLocalCell( block_, x, y, z );
 
diff --git a/src/field/distributors/NearestNeighborDistributor.h b/src/field/distributors/NearestNeighborDistributor.h
index a07ea9134..6aa4ba295 100644
--- a/src/field/distributors/NearestNeighborDistributor.h
+++ b/src/field/distributors/NearestNeighborDistributor.h
@@ -75,6 +75,7 @@ public:
 
       WALBERLA_CHECK( !blockStorage_.expired() );
       auto blockStorage = blockStorage_.lock();
+      WALBERLA_CHECK_NOT_NULLPTR(blockStorage);
 
       Cell nearestCell = blockStorage->getBlockLocalCell( block_, x, y, z );
 
diff --git a/src/field/interpolators/KernelFieldInterpolator.h b/src/field/interpolators/KernelFieldInterpolator.h
index ba40eecdb..eff9e888a 100644
--- a/src/field/interpolators/KernelFieldInterpolator.h
+++ b/src/field/interpolators/KernelFieldInterpolator.h
@@ -122,6 +122,7 @@ public:
 
       WALBERLA_CHECK( !blockStorage_.expired() );
       auto blockStorage = blockStorage_.lock();
+      WALBERLA_CHECK_NOT_NULLPTR(blockStorage);
 
       Cell centerCell = blockStorage->getBlockLocalCell( block_, x, y, z );
 
diff --git a/src/field/interpolators/NearestNeighborFieldInterpolator.h b/src/field/interpolators/NearestNeighborFieldInterpolator.h
index 716d4021c..45e9110de 100644
--- a/src/field/interpolators/NearestNeighborFieldInterpolator.h
+++ b/src/field/interpolators/NearestNeighborFieldInterpolator.h
@@ -74,6 +74,7 @@ public:
 
       WALBERLA_CHECK( !blockStorage_.expired() );
       auto blockStorage = blockStorage_.lock();
+      WALBERLA_CHECK_NOT_NULLPTR(blockStorage);
 
       Cell nearestCell = blockStorage->getBlockLocalCell( block_, x, y, z );
 
diff --git a/src/field/interpolators/TrilinearFieldInterpolator.h b/src/field/interpolators/TrilinearFieldInterpolator.h
index e14a36fb1..48d6b2ce9 100644
--- a/src/field/interpolators/TrilinearFieldInterpolator.h
+++ b/src/field/interpolators/TrilinearFieldInterpolator.h
@@ -78,6 +78,7 @@ public:
 
       WALBERLA_CHECK( !blockStorage_.expired() );
       auto blockStorage = blockStorage_.lock();
+      WALBERLA_CHECK_NOT_NULLPTR(blockStorage);
 
       const real_t dx = blockStorage->dx( blockStorage->getLevel( block_ ) );
       const real_t dy = blockStorage->dy( blockStorage->getLevel( block_ ) );
-- 
GitLab