From 1b5c161f0af7083925d0600f4bc4b31bf5a4ca2d Mon Sep 17 00:00:00 2001 From: Tobias Reiter Date: Fri, 14 Jun 2024 15:19:33 +0200 Subject: [PATCH] Add warning is non-existent data is accessed in lsPointData --- include/viennals/lsPointData.hpp | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/include/viennals/lsPointData.hpp b/include/viennals/lsPointData.hpp index 5ac06a43..baae835c 100644 --- a/include/viennals/lsPointData.hpp +++ b/include/viennals/lsPointData.hpp @@ -99,6 +99,11 @@ class PointData { if (int i = getScalarDataIndex(searchLabel); i != -1) { return &(scalarData[i]); } + Logger::getInstance() + .addWarning("PointData attempted to access scalar data labeled '" + + searchLabel + + "', which does not exist. Returning nullptr instead.") + .print(); return nullptr; } @@ -106,6 +111,11 @@ class PointData { if (int i = getScalarDataIndex(searchLabel); i != -1) { return &(scalarData[i]); } + Logger::getInstance() + .addWarning("PointData attempted to access scalar data labeled '" + + searchLabel + + "', which does not exist. Returning nullptr instead.") + .print(); return nullptr; } @@ -146,6 +156,11 @@ class PointData { if (int i = getVectorDataIndex(searchLabel); i != -1) { return &(vectorData[i]); } + Logger::getInstance() + .addWarning("PointData attempted to access scalar data labeled '" + + searchLabel + + "', which does not exist. Returning nullptr instead.") + .print(); return nullptr; } @@ -153,6 +168,11 @@ class PointData { if (int i = getVectorDataIndex(searchLabel); i != -1) { return &(vectorData[i]); } + Logger::getInstance() + .addWarning("PointData attempted to access scalar data labeled '" + + searchLabel + + "', which does not exist. Returning nullptr instead.") + .print(); return nullptr; }