Przeglądaj źródła

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 lat temu
rodzic
commit
ef27cafbfc
1 zmienionych plików z 1 dodań i 1 usunięć
  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