Sfoglia il codice sorgente

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 anni fa
parent
commit
ef27cafbfc
1 ha cambiato i file con 1 aggiunte e 1 eliminazioni
  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