0030469: Visualization - Draw crashes when 3D view is minimized
[occt.git] / src / OpenGl / OpenGl_BVHTreeSelector.cxx
index a3bcd1e..95edcad 100644 (file)
@@ -96,10 +96,10 @@ void OpenGl_BVHTreeSelector::SetViewportSize (Standard_Integer theViewportWidth,
                                               Standard_Integer theViewportHeight,
                                               Standard_Real theResolutionRatio)
 {
-  myViewportHeight = theViewportHeight;
-  myViewportWidth  = theViewportWidth;
-  myPixelSize = Max (theResolutionRatio / theViewportHeight,
-                     theResolutionRatio / theViewportWidth);
+  myViewportHeight = theViewportHeight > 0 ? theViewportHeight : 1;
+  myViewportWidth  = theViewportWidth  > 0 ? theViewportWidth  : 1;
+  myPixelSize = Max (theResolutionRatio / myViewportHeight,
+                     theResolutionRatio / myViewportWidth);
 }
 
 // =======================================================================