Reply

C++ API Bug: GetBalloonDisplayedText() crashes if link points to nowhere

If the balloon contains a link which points to nowhere, the program crashes inside GetBalloonDisplayedText().

 

The program should not crash here but return an empty string.

3 REPLIES

Re: C++ API Bug: GetBalloonDisplayedText() crashes if link points to nowhere

Be sure to file an  Incident Report (IR) with GTAC. I talk about this in my blog post API Bugs.

Jason Newell
Applications Architect
www.jasonnewell.net

Re: C++ API Bug: GetBalloonDisplayedText() crashes if link points to nowhere

I was doing a simple test and could not see the crash on GetBalloonDisplayedText. The text returned was " Link?R -1", but the GetTerminator method throws an exception, if the the balloon was not linked.

Are you catching any COM exceptions in your code? Maybe SE crashes as you did not catch the exception.

I agree that GetBalloonDisplayedText should not crash or raise an exception, if the balloon is not linked. The same should be the case for the GetTerminator method.

I was trying to check for any linked object first by calling GetTerminator and expecting a NULL pointer returned in the first parameter, if there is no linked object.

Re: C++ API Bug: GetBalloonDisplayedText() crashes if link points to nowhere

How it has been:
std::string text = static_cast<char*>(balloonPtr->GetBalloonDisplayedText());

Now I solved the Problem by this:
_bstr_t bString = balloonPtr->GetBalloonDisplayedText();
if (static_cast<const char*>(bString) != nullptr)
std::string text = static_cast<const char*>(bString);