[RFC] added null check

Added null check before detach since some objects are available only for different payment types