String to image

Stimulsoft Reports.NET discussion
Post Reply
Sacha
Posts: 19
Joined: Tue Mar 27, 2007 11:21 am
Location: Montréal

String to image

Post by Sacha »

Hi !
I have a question about the parsing of image from string.
Right now, it crashes because I don't have an image (it's optional in our report) and the string is empty.
This looks like it is as it should be, but the report engine crashes in the file "Components\StiImage.cs"
in the method "protected override Image GetImageFromSource()" during the call "return StiImageConverter.StringToImage(imageObject as string);"

It crashes because it creates a memorystream with an empty string and try to create an image from it.
Obviously it should do that and just return a null value in that case.

I did a test by changing the GetImageFromSource method code from

if (imageObject is string)
{
return StiImageConverter.StringToImage(imageObject as string);
}

to

if (imageObject is string && ((string)imageObject).Length != 0)
{
return StiImageConverter.StringToImage(imageObject as string);
}

And everything works fine for me now.
Is there unforeseen side effect to that that i should know of ?
Can I expect to get this fix in a build ? if yes, when is the next one ? :)

Thanks

Sacha
Vital
Posts: 1278
Joined: Fri Jun 09, 2006 4:04 am

String to image

Post by Vital »

Thank you for your information. We have updated our code. Fix will be included in build from 19 April.

Post Reply