Hi ,

Thanks for the mail Frank.

The problem is rightly pointed. In my case the dataset (poDataset) is not
getting created at times (parameters being the same) . I have checked
thoroughly everything related to this, but did not find any either solution
or problem.

I would appreciate if you can assist me solving this issue.

Regards,
Srikanth



On Fri, Aug 14, 2009 at 5:31 PM, Frank Warmerdam <warmer...@pobox.com>wrote:

> On Fri, Aug 14, 2009 at 2:59 AM, Srikanth<srikanth1...@gmail.com> wrote:
> > Dear All,
> >
> > I am reading and writing raster images using GDAL. Below is the code
> which I
> > am using for writing a raster.
> > At times the code is working fine. But many a time , it is getting
> crashed
> > in the GetRasterBand. I have debugged the code several times and the
> > variables passed seems to be perfect. Any help in this is regard would be
> > appreciated.
> ...
> >    poDataset=NULL;
> >    poDataset = poDriver->Create(filename , width , height , numOfbands
> > ,(GDALDataType)datatype,NULL);
> >
> >    for(int i=0 ; i < numOfbands ; i++)
> >      {
> >              poBand[i] = poDataset->GetRasterBand(i+1);
> >       }
>
> Hi,
>
> I didn't see any showstopper problems in your code.  But
> the above code is not safe if the dataset creation fails.
> If the dataset creation fails, a null pointer will be returned
> and GetRasterBand() will fail - possibly crashing.
>
> Best regards,
> --
>
> ---------------------------------------+--------------------------------------
> I set the clouds in motion - turn up   | Frank Warmerdam,
> warmer...@pobox.com
> light and sound - activate the windows | http://pobox.com/~warmerdam
> and watch the world go round - Rush    | Geospatial Programmer for Rent
>



-- 
Regards,
Srikanth K.
www.servetheneedy.org
_______________________________________________
gdal-dev mailing list
gdal-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/gdal-dev

Reply via email to