[Insight-developers] SmartPointer null check

Miklos Espak espakm at gmail.com
Wed Oct 19 13:57:46 EDT 2011


Hi,

would it be possible to make a NULL check in itk::SmartPointer::operator->
and operator* ?

I thought an std::runtime_error (or derivant) could be thrown if m_Pointer
is 0. In this way the application would not crash on null pointer
dereference but it could be caught from a GUI eventually. That could spare a
lot of null checks in the code.

Sorry, if this is a recurring topic of discussion or it is already
implemented in ITK 4.0. I use 3.20.0 as part of MITK.

Best regards,
Miklos Espak
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/mailman/private/insight-developers/attachments/20111019/9ef56d71/attachment.htm>


More information about the Insight-developers mailing list