Segmentation fault when running exampleB1

Hello,dear Geant4 users! :smiley:
When i run exampleB1 and output the position of presteppoint and poststeppoint,i meet the followling problem :smiling_face_with_tear::
ZQE}88U%3TEX47FE`8W10A
The world is 100cm100cm100cm,locates at (0,0,0).What’s wrong with my code?How can i solve the problem?Thanks very much for your help!

I found this error always occured at the end of a run.When i ran 50 events:

And when i ran 50000 events:

Did you build exactly exampleB1, or is this your own code “based on” exampleB1? Have you tried running in the debugger to see where the segault happens specifically?