Browse Source

Fix qDebug operator to handle case when VTKObject is null

In case the debug statement is used in the destructor, this commit
will prevent the application from crashing.
Jean-Christophe Fillion-Robin 11 years ago
parent
commit
ef27cafbfc
1 changed files with 1 additions and 1 deletions
  1. 1 1
      Libs/Visualization/VTK/Core/ctkVTKConnection.cpp

+ 1 - 1
Libs/Visualization/VTK/Core/ctkVTKConnection.cpp

@@ -238,7 +238,7 @@ QDebug operator<<(QDebug dbg, const ctkVTKConnection& connection)
   const ctkVTKConnectionPrivate* d = connection.d_func();
   dbg.nospace() << "ctkVTKConnection:" << &connection << endl
                 << "Id:" << d->Id << endl
-                << " VTKObject:" << d->VTKObject->GetClassName()
+                << " VTKObject:" << (d->VTKObject ? d->VTKObject->GetClassName() : "<null>")
                 << "(" << d->VTKObject << ")" << endl
                 << " QtObject:" << d->QtObject << endl
                 << " VTKEvent:" << d->VTKEvent << endl