prevent null pointer on undefined material