소스 검색

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 년 전
부모
커밋
ef27cafbfc
1개의 변경된 파일1개의 추가작업 그리고 1개의 파일을 삭제
  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