]> OCCT Git - occt.git/commitdiff
0032912: Visualization - crash when displaying an OBJ file with missing texture file
authorkgv <kgv@opencascade.com>
Tue, 5 Apr 2022 22:26:00 +0000 (01:26 +0300)
committerkgv <kgv@opencascade.com>
Thu, 7 Apr 2022 05:06:59 +0000 (08:06 +0300)
Fix NULL dereference within Graphic3d_TextureRoot::convertToCompatible() due to wrong order of checks.

src/Graphic3d/Graphic3d_TextureRoot.cxx

index a89f32dabe3a2e8f6b0d328af9baefbaadd7ea1e..13f77134cf64fd18bf6437ef96235f8934a56ea3 100644 (file)
@@ -214,9 +214,9 @@ Handle(Image_PixMap) Graphic3d_TextureRoot::GetImage (const Handle(Image_Support
 void Graphic3d_TextureRoot::convertToCompatible (const Handle(Image_SupportedFormats)& theSupported,
                                                  const Handle(Image_PixMap)& theImage)
 {
-  if (theSupported.IsNull()
-   || theSupported->IsSupported (theImage->Format())
-   || theImage.IsNull())
+  if (theImage.IsNull()
+   || theSupported.IsNull()
+   || theSupported->IsSupported (theImage->Format()))
   {
     return;
   }