]> 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)
committersmoskvin <smoskvin@opencascade.com>
Wed, 6 Apr 2022 19:58:16 +0000 (22:58 +0300)
Fix NULL dereference within Graphic3d_TextureRoot::convertToCompatible() due to wrong order of checks.

src/Graphic3d/Graphic3d_TextureRoot.cxx

index 027a5ebe4e8c5218ae3fdf7f681ea0d059db9857..3595871c0315ace816d4e0f105f3685fe7b08385 100644 (file)
@@ -216,9 +216,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;
   }