diff --git a/src/osgPlugins/osgjs/JSON_Objects.cpp b/src/osgPlugins/osgjs/JSON_Objects.cpp index 69a259223..f71641f2f 100644 --- a/src/osgPlugins/osgjs/JSON_Objects.cpp +++ b/src/osgPlugins/osgjs/JSON_Objects.cpp @@ -216,7 +216,10 @@ void JSONObject::encodeArrayAsVarintBuffer(osg::Array const* array, std::vector< } template -void JSONObject::dumpVarintVector(std::vector& oss, T const* buffer, bool isUnsigned) const { +void JSONObject::dumpVarintVector(std::vector& oss, T const* buffer, bool isUnsigned) const +{ + if (!buffer) return; + unsigned int n = buffer->getDataSize(); for(typename T::const_iterator it = buffer->begin() ; it != buffer->end() ; ++ it) { for(unsigned int i = 0 ; i < n ; ++ i) { @@ -229,7 +232,10 @@ void JSONObject::dumpVarintVector(std::vector& oss, T const* buffer, bo } template -void JSONObject::dumpVarintValue(std::vector& oss, T const* buffer, bool isUnsigned) const { +void JSONObject::dumpVarintValue(std::vector& oss, T const* buffer, bool isUnsigned) const +{ + if (!buffer) return; + for(typename T::const_iterator it = buffer->begin() ; it != buffer->end() ; ++ it) { unsigned int value = isUnsigned ? (*it) : JSONObject::toVarintUnsigned(*it);