Prevent a crash using SBStructuredData.GetDescription.
For some reason SBStructuredData requires a plugin for printing, and
doesn't have a default version that just prints the current contents
as JSON or something sensible?
I'm not sure what is supposed to happen here, but as the code stands
now, trying to call GetDescription on an SBStructuredData will crash
when the empty weak pointer is turned into a shared pointer.
This patch just adds a check that the weak pointer hasn't expired
before trying to access it. That prevents the crash.
This fix seems fairly obvious, but I put it up here in case somebody knows what is
actually supposed to happen here, the state of things doesn't make much sense to me.
This is racy. The right way to do that is to call m_plugin_wp.lock() and then check the validity of the returned shared_ptr.