Check d->type before access d->type->foo.