diff --git a/src/ViewerTest/ViewerTest.cxx b/src/ViewerTest/ViewerTest.cxx index a81276b24d..e81f4cfe99 100644 --- a/src/ViewerTest/ViewerTest.cxx +++ b/src/ViewerTest/ViewerTest.cxx @@ -3863,7 +3863,11 @@ Standard_Integer VTexture (Draw_Interpretor& theDi, Standard_Integer theArgsNb, { aTextureVecNew.SetValue (aTexIndex, Handle(Graphic3d_Texture2Dmanual)()); } - aTextureVecNew.ChangeValue (aTexIndex)->GetParams()->SetTextureUnit ((Graphic3d_TextureUnit )aTexIndex); + + if (aTextureVecNew.Value (aTexIndex)) + { + aTextureVecNew.ChangeValue(aTexIndex)->GetParams()->SetTextureUnit((Graphic3d_TextureUnit)aTexIndex); + } } else { diff --git a/tests/bugs/vis/bug29651 b/tests/bugs/vis/bug29651 new file mode 100644 index 0000000000..b0fd702e6f --- /dev/null +++ b/tests/bugs/vis/bug29651 @@ -0,0 +1,17 @@ +puts "========" +puts "OCC29651" +puts "========" +puts "" +########################################## +# ViewerTest - vtexture command crashes +########################################## + +vinit +vsetdispmode 1 +box b 1 2 3 +vdisplay b +vfit +vtexture b 0 +vtexture b off + +checkview -screenshot -3d -path ${imagedir}/${test_image}.png