Preventing null-pointer derefs