On the error of an itk image pointer assignment

When I pass the itk image between the two classes, random errors will occur in the assignment. Sometimes the code can run normally, sometimes errors will occur, and access conflicts will occur.
itkimage=myReader->GetItkSeriesImage(0);

I checked through the log that the image data was normal before the function returned, but the error occurred during the assignment statement, itk:: MapContainer<int, ImageType:: Pointer>itkSeriesImageMap; I also use this class to store itk images. Is it related to this?