From c2a3d24ef3c77f4c1457f69c21ef7fc5091494b8 Mon Sep 17 00:00:00 2001 From: James Turner Date: Fri, 14 Jan 2011 20:04:20 +0000 Subject: [PATCH] Make the Nasal NaN check less aggressive - still SG_ALERT, but return nil instead of terminating the Nasal script completely. --- src/Scripting/NasalSys.cxx | 2 +- src/Scripting/nasal-props.cxx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Scripting/NasalSys.cxx b/src/Scripting/NasalSys.cxx index 158d852e5..1f952b325 100644 --- a/src/Scripting/NasalSys.cxx +++ b/src/Scripting/NasalSys.cxx @@ -190,7 +190,7 @@ static naRef f_getprop(naContext c, naRef me, int argc, naRef* args) double dv = p->getDoubleValue(); if (osg::isNaN(dv)) { SG_LOG(SG_GENERAL, SG_ALERT, "Nasal getprop: property " << p->getPath() << " is NaN"); - naRuntimeError(c, "getprop() would have read NaN"); + return naNil(); } return naNum(dv); diff --git a/src/Scripting/nasal-props.cxx b/src/Scripting/nasal-props.cxx index 0ea341b08..214cc5c9a 100644 --- a/src/Scripting/nasal-props.cxx +++ b/src/Scripting/nasal-props.cxx @@ -173,7 +173,7 @@ static naRef f_getValue(naContext c, naRef me, int argc, naRef* args) double dv = (*node)->getDoubleValue(); if (osg::isNaN(dv)) { SG_LOG(SG_GENERAL, SG_ALERT, "Nasal getValue: property " << (*node)->getPath() << " is NaN"); - naRuntimeError(c, "props.getValue() would have read NaN"); + return naNil(); } return naNum(dv);