# Buggy code
def _prepare_result(self):
    tmp = []

    for server in self.hcloud_server_info:
        if server is not None:
            tmp.append(
                {
                    "id": to_native(server.id),
                    "name": to_native(server.name),
                    "ipv4_address": to_native(server.public_net.ipv4.ip),
                    "ipv6": to_native(server.public_net.ipv6.ip),
                    "image": to_native(server.image.name),
                    "server_type": to_native(server.server_type.name),
                    "datacenter": to_native(server.datacenter.name),
                    "location": to_native(server.datacenter.location.name),
                    "rescue_enabled": server.rescue_enabled,
                    "backup_window": to_native(server.backup_window),
                    "labels": server.labels,
                    "status": to_native(server.status),
                    "delete_protection": server.protection["delete"],
                    "rebuild_protection": server.protection["rebuild"],
                }
            )
    return tmp


# Traceback (AttributeError)
The full traceback is:
Traceback (most recent call last):
File "/home/andor/.ansible/tmp/ansible-tmp-1573035298.4213414-249660851701701/AnsiballZ_hcloud_server_info.py", line 102,
in <module>
_ansiballz_main()
File "/home/andor/.ansible/tmp/ansible-tmp-1573035298.4213414-249660851701701/AnsiballZ_hcloud_server_info.py", line 94,
in _ansiballz_main
invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)
File "/home/andor/.ansible/tmp/ansible-tmp-1573035298.4213414-249660851701701/AnsiballZ_hcloud_server_info.py", line 40, in invoke_module
runpy.run_module(mod_name='ansible.modules.cloud.hcloud.hcloud_server_info', init_globals=None, run_name='__main__', alter_sys=False)
File "/usr/lib/python3.7/runpy.py", line 208, in run_module
return _run_code(code, {}, init_globals, run_name, mod_spec)
File "/usr/lib/python3.7/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/tmp/ansible_hcloud_server_info_payload_x1rpfqer/ansible_hcloud_server_info_payload.zip/ansible/modules/cloud/hcloud/hcloud_server_info.py", line 214, in <module>
File "/tmp/ansible_hcloud_server_info_payload_x1rpfqer/ansible_hcloud_server_info_payload.zip/ansible/modules/cloud/hcloud/hcloud_server_info.py", line 199, in main
File "/tmp/ansible_hcloud_server_info_payload_x1rpfqer/ansible_hcloud_server_info_payload.zip/ansible/module_utils/hcloud.py", line 62, in get_result
File "/tmp/ansible_hcloud_server_info_payload_x1rpfqer/ansible_hcloud_server_info_payload.zip/ansible/modules/cloud/hcloud/hcloud_server_info.py", line 146, in _prepare_result
AttributeError: 'NoneType' object has no attribute 'name'

# Fixed code
def _prepare_result(self):
    tmp = []

    for server in self.hcloud_server_info:
        if server is not None:
            image = None if server.image is None else to_native(server.image.name)
            tmp.append(
                {
                    "id": to_native(server.id),
                    "name": to_native(server.name),
                    "ipv4_address": to_native(server.public_net.ipv4.ip),
                    "ipv6": to_native(server.public_net.ipv6.ip),
                    "image": image,
                    "server_type": to_native(server.server_type.name),
                    "datacenter": to_native(server.datacenter.name),
                    "location": to_native(server.datacenter.location.name),
                    "rescue_enabled": server.rescue_enabled,
                    "backup_window": to_native(server.backup_window),
                    "labels": server.labels,
                    "status": to_native(server.status),
                    "delete_protection": server.protection["delete"],
                    "rebuild_protection": server.protection["rebuild"],
                }
            )
    return tmp