Attempt to check type when size==0
Add null check