# Buggy code
def _taskshandlers_children(basedir, k, v, parent_type: FileType) -> List:
    results = []
    for th in v:
        # ignore empty tasks, `-`
        if not th:
            continue

        with contextlib.suppress(LookupError):
            children = _get_task_handler_children_for_tasks_or_playbooks(
                th,
                basedir,
                k,
                parent_type,
            )
            results.append(children)
            continue

        if (
            "include_role" in th or "import_role" in th
        ):  # lgtm [py/unreachable-statement]
            th = normalize_task_v2(th)
            _validate_task_handler_action_for_role(th["action"])
            results.extend(
                _roles_children(
                    basedir,
                    k,
                    [th["action"].get("name")],
                    parent_type,
                    main=th["action"].get("tasks_from", "main"),
                )
            )
            continue

        if "block" not in th:
            continue

        results.extend(_taskshandlers_children(basedir, k, th["block"], parent_type))
        if "rescue" in th:
            results.extend(
                _taskshandlers_children(basedir, k, th["rescue"], parent_type)
            )
        if "always" in th:
            results.extend(
                _taskshandlers_children(basedir, k, th["always"], parent_type)
            )

    return results


# Traceback (TypeError)
Traceback (most recent call last):
File "/Users/ssbarnea/.pyenv/versions/3.8.2/bin/ansible-lint", line 11, in <module>
load_entry_point('ansible-lint', 'console_scripts', 'ansible-lint')()
File "/Users/ssbarnea/c/os/ansible-lint/lib/ansiblelint/__main__.py", line 94, in main
matches.extend(runner.run())
File "/Users/ssbarnea/c/os/ansible-lint/lib/ansiblelint/__init__.py", line 159, in run
for child in ansiblelint.utils.find_children(arg, self.playbook_dir):
File "/Users/ssbarnea/c/os/ansible-lint/lib/ansiblelint/utils.py", line 195, in find_children
for child in _rebind_match_filename(playbook[0], play_children)(
File "/Users/ssbarnea/c/os/ansible-lint/lib/ansiblelint/utils.py", line 174, in func_wrapper
return func(*args, **kwargs)
File "/Users/ssbarnea/c/os/ansible-lint/lib/ansiblelint/utils.py", line 248, in play_children
return delegate_map[k](basedir, k, v, parent_type)
File "/Users/ssbarnea/c/os/ansible-lint/lib/ansiblelint/utils.py", line 287, in _taskshandlers_children
results.extend(_taskshandlers_children(basedir, k, th['block'], parent_type))
File "/Users/ssbarnea/c/os/ansible-lint/lib/ansiblelint/utils.py", line 264, in _taskshandlers_children
for th in v:
TypeError: 'NoneType' object is not iterable

# Fixed code
def _taskshandlers_children(basedir, k, v, parent_type: FileType) -> List:
    results = []
    if v is None:
        raise MatchError(
            message="A malformed block was encountered while loading a block.",
            rule=RuntimeErrorRule,
        )
    for th in v:
        # ignore empty tasks, `-`
        if not th:
            continue

        with contextlib.suppress(LookupError):
            children = _get_task_handler_children_for_tasks_or_playbooks(
                th,
                basedir,
                k,
                parent_type,
            )
            results.append(children)
            continue

        if (
            "include_role" in th or "import_role" in th
        ):  # lgtm [py/unreachable-statement]
            th = normalize_task_v2(th)
            _validate_task_handler_action_for_role(th["action"])
            results.extend(
                _roles_children(
                    basedir,
                    k,
                    [th["action"].get("name")],
                    parent_type,
                    main=th["action"].get("tasks_from", "main"),
                )
            )
            continue

        if "block" not in th:
            continue

        results.extend(_taskshandlers_children(basedir, k, th["block"], parent_type))
        if "rescue" in th:
            results.extend(
                _taskshandlers_children(basedir, k, th["rescue"], parent_type)
            )
        if "always" in th:
            results.extend(
                _taskshandlers_children(basedir, k, th["always"], parent_type)
            )

    return results