From a36d45e68b99489f825c12e7d0328734e60c366c Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Wed, 23 Jul 2003 08:18:19 +0000 Subject: [PATCH] Added check to allocateImage() so that if the pixel size wouldn't be computed unless valid _data already existed on the object. --- src/osg/Image.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/osg/Image.cpp b/src/osg/Image.cpp index 0dac9fa23..0bfcd0909 100644 --- a/src/osg/Image.cpp +++ b/src/osg/Image.cpp @@ -302,7 +302,9 @@ void Image::allocateImage(int s,int t,int r, { _mipmapData.clear(); - unsigned int previousTotalSize = computeRowWidthInBytes(_s,_pixelFormat,_dataType,_packing)*_t*_r; + unsigned int previousTotalSize = 0; + + if (_data) previousTotalSize = computeRowWidthInBytes(_s,_pixelFormat,_dataType,_packing)*_t*_r; unsigned int newTotalSize = computeRowWidthInBytes(s,format,type,packing)*t*r;