Remove redundant assignment
Add assertions to guard against nullptr