Added an assert to avoid write over a nullptr
Gramar/traling spaces