for me it runs smoothly without any crash for 500 events. Does it crash directly or after some events?
In my understanding these lines of code should never be reached, because this histograms are not set. I will give now a dedicated initialization of the pointer to 0.