From 7373e19fa112090dff714bc7b0c3a30643904cb5 Mon Sep 17 00:00:00 2001 From: san Date: Tue, 27 Mar 2018 11:54:12 +0300 Subject: [PATCH] 0029651: ViewerTest - vtexture command crashes Missing null check added Add test case bugs/vis/bug29651 --- src/ViewerTest/ViewerTest.cxx | 6 +++++- tests/bugs/vis/bug29651 | 17 +++++++++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) create mode 100644 tests/bugs/vis/bug29651 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