Removed unnecessary assert and fixed potential free of null