# Buggy code
def _invoke_field_validators(self, unmarshal, data, many):
    for attr_name in self.__processors__[(VALIDATES, False)]:
        validator = getattr(self, attr_name)
        validator_kwargs = validator.__marshmallow_kwargs__[(VALIDATES, False)]
        field_name = validator_kwargs["field_name"]

        try:
            field_obj = self.fields[field_name]
        except KeyError:
            if field_name in self.declared_fields:
                continue
            raise ValueError('"{0}" field does not exist.'.format(field_name))

        if many:
            for idx, item in enumerate(data):
                try:
                    value = item[field_obj.attribute or field_name]
                except KeyError:
                    pass
                else:
                    validated_value = unmarshal.call_and_store(
                        getter_func=validator,
                        data=value,
                        field_name=field_obj.load_from or field_name,
                        field_obj=field_obj,
                        index=(idx if self.opts.index_errors else None),
                    )
                    if validated_value is missing:
                        data[idx].pop(field_name, None)
        else:
            try:
                value = data[field_obj.attribute or field_name]
            except KeyError:
                pass
            else:
                validated_value = unmarshal.call_and_store(
                    getter_func=validator,
                    data=value,
                    field_name=field_obj.load_from or field_name,
                    field_obj=field_obj,
                )
                if validated_value is missing:
                    data.pop(field_name, None)


# Traceback (TypeError)
Traceback (most recent call last):
File "/_/bug_mschema.py", line 19, in <module>
'bar': 'invalid',
File "/_/env/lib/python3.7/site-packages/marshmallow/schema.py", line 628, in validate
_, errors = self._do_load(data, many, partial=partial, postprocess=False)
File "/_/env/lib/python3.7/site-packages/marshmallow/schema.py", line 670, in _do_load
index_errors=self.opts.index_errors,
File "/_/env/lib/python3.7/site-packages/marshmallow/marshalling.py", line 292, in deserialize
index=(index if index_errors else None)
File "/_/env/lib/python3.7/site-packages/marshmallow/marshalling.py", line 65, in call_and_store
value = getter_func(data)
File "/_/env/lib/python3.7/site-packages/marshmallow/marshalling.py", line 285, in <lambda>
data
File "/_/env/lib/python3.7/site-packages/marshmallow/fields.py", line 265, in deserialize
output = self._deserialize(value, attr, data)
File "/_/env/lib/python3.7/site-packages/marshmallow/fields.py", line 465, in _deserialize
data, errors = self.schema.load(value)
File "/_/env/lib/python3.7/site-packages/marshmallow/schema.py", line 588, in load
result, errors = self._do_load(data, many, partial=partial, postprocess=True)
File "/_/env/lib/python3.7/site-packages/marshmallow/schema.py", line 674, in _do_load
self._invoke_field_validators(unmarshal, data=result, many=many)
File "/_/env/lib/python3.7/site-packages/marshmallow/schema.py", line 894, in _invoke_field_validators
value = data[field_obj.attribute or field_name]
TypeError: 'NoneType' object is not subscriptable

# Fixed code
def _invoke_field_validators(self, unmarshal, data, many):
    for attr_name in self.__processors__[(VALIDATES, False)]:
        validator = getattr(self, attr_name)
        validator_kwargs = validator.__marshmallow_kwargs__[(VALIDATES, False)]
        field_name = validator_kwargs["field_name"]

        try:
            field_obj = self.fields[field_name]
        except KeyError:
            if field_name in self.declared_fields:
                continue
            raise ValueError('"{0}" field does not exist.'.format(field_name))

        if many:
            for idx, item in enumerate(data):
                try:
                    value = item[field_obj.attribute or field_name]
                except (KeyError, TypeError):
                    pass
                else:
                    validated_value = unmarshal.call_and_store(
                        getter_func=validator,
                        data=value,
                        field_name=field_obj.load_from or field_name,
                        field_obj=field_obj,
                        index=(idx if self.opts.index_errors else None),
                    )
                    if validated_value is missing:
                        data[idx].pop(field_name, None)
        else:
            try:
                value = data[field_obj.attribute or field_name]
            except (KeyError, TypeError):
                pass
            else:
                validated_value = unmarshal.call_and_store(
                    getter_func=validator,
                    data=value,
                    field_name=field_obj.load_from or field_name,
                    field_obj=field_obj,
                )
                if validated_value is missing:
                    data.pop(field_name, None)