From 3c1d3b981c94253663435f2389462b164bd182ac Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Wed, 29 Jun 2016 17:29:28 +0100 Subject: [PATCH] Added null pointer handling --- src/osgPlugins/txp/trpage_model.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/osgPlugins/txp/trpage_model.cpp b/src/osgPlugins/txp/trpage_model.cpp index 77326fd13..4565717e6 100644 --- a/src/osgPlugins/txp/trpage_model.cpp +++ b/src/osgPlugins/txp/trpage_model.cpp @@ -218,9 +218,14 @@ bool trpgModel::GetType(int &t) } bool trpgModel::GetName(char *str,int strLen) const { - if (!isValid()) return false; - int len = (name ? strlen(name) : 0); + if (!isValid() || !name) + { + return false; + } + + int len = strlen(name); strncpy(str,name,MIN(len,strLen)+1); + return true; } bool trpgModel::GetNumTiles(int &ret) const