From 9c605ba9beaca8d5ff90f269a9450533418cf1c0 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Mon, 13 Nov 2017 13:06:12 +0000 Subject: [PATCH] Fixed CoverityScan reported errors --- .../serializers/osgAnimation/AnimationManagerBase.cpp | 5 ++--- .../serializers/osgAnimation/BasicAnimationManager.cpp | 8 ++++---- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/src/osgWrappers/serializers/osgAnimation/AnimationManagerBase.cpp b/src/osgWrappers/serializers/osgAnimation/AnimationManagerBase.cpp index 65ec91c3c..64d738da7 100644 --- a/src/osgWrappers/serializers/osgAnimation/AnimationManagerBase.cpp +++ b/src/osgWrappers/serializers/osgAnimation/AnimationManagerBase.cpp @@ -43,7 +43,7 @@ struct osgAnimation_AnimationManagerBasegetnumAnimations : public osgDB::MethodO virtual bool run(void* objectPtr, osg::Parameters& inputParameters, osg::Parameters& outputParameters) const { osgAnimation::AnimationManagerBase* group = dynamic_cast(reinterpret_cast(objectPtr)); - outputParameters.push_back(new osg::UIntValueObject("return",group->getNumRegisteredAnimations())); + if (group) outputParameters.push_back(new osg::UIntValueObject("return",group->getNumRegisteredAnimations())); return true; } }; @@ -64,8 +64,7 @@ struct osgAnimation_AnimationManagerBasegetAnimation : public osgDB::MethodObjec if (uivo) index = uivo->getValue(); } osgAnimation::AnimationManagerBase* group = dynamic_cast(reinterpret_cast(objectPtr)); - outputParameters.push_back(group->getRegisteredAnimation(index)); - + if (group) outputParameters.push_back(group->getRegisteredAnimation(index)); return true; } diff --git a/src/osgWrappers/serializers/osgAnimation/BasicAnimationManager.cpp b/src/osgWrappers/serializers/osgAnimation/BasicAnimationManager.cpp index 8aef704c8..8cb63e2d3 100644 --- a/src/osgWrappers/serializers/osgAnimation/BasicAnimationManager.cpp +++ b/src/osgWrappers/serializers/osgAnimation/BasicAnimationManager.cpp @@ -15,7 +15,7 @@ struct BasicAnimationManagerIsplaying : public osgDB::MethodObject osgAnimation::Animation* child = dynamic_cast(inputParameters[0].get()); if (!child) return false; osgAnimation::BasicAnimationManager* group = dynamic_cast(reinterpret_cast(objectPtr)); - outputParameters.push_back(new osg::BoolValueObject("return", group->isPlaying(child))); + id (group) outputParameters.push_back(new osg::BoolValueObject("return", group->isPlaying(child))); return true; } }; @@ -28,7 +28,7 @@ struct BasicAnimationManagerfindAnimation : public osgDB::MethodObject osgAnimation::Animation* child = dynamic_cast(inputParameters[0].get()); if (!child) return false; osgAnimation::BasicAnimationManager* group = dynamic_cast(reinterpret_cast(objectPtr)); - outputParameters.push_back(new osg::BoolValueObject("return",group->findAnimation(child))); + id (group) outputParameters.push_back(new osg::BoolValueObject("return",group->findAnimation(child))); return true; } }; @@ -41,7 +41,7 @@ struct BasicAnimationManagerPlayanimation : public osgDB::MethodObject osgAnimation::Animation* child = dynamic_cast(inputParameters[0].get()); if (!child) return false; osgAnimation::BasicAnimationManager* group = dynamic_cast(reinterpret_cast(objectPtr)); - group->playAnimation(child); + id (group) group->playAnimation(child); return true; } }; @@ -54,7 +54,7 @@ struct BasicAnimationManagerStopanimation : public osgDB::MethodObject osgAnimation::Animation* child = dynamic_cast(inputParameters[0].get()); if (!child) return false; osgAnimation::BasicAnimationManager* group = dynamic_cast(reinterpret_cast(objectPtr)); - group->stopAnimation(child); + id (group) group->stopAnimation(child); return true; } };