# Buggy code
def _parse_dowhile(self, doWhilestatement, node):
    node_startDoWhile = self._new_node(NodeType.STARTLOOP, doWhilestatement["src"])
    node_condition = self._new_node(NodeType.IFLOOP, doWhilestatement["src"])

    if self.is_compact_ast:
        node_condition.add_unparsed_expression(doWhilestatement["condition"])
        statement = self._parse_statement(doWhilestatement["body"], node_condition)
    else:
        children = doWhilestatement[self.get_children("children")]
        # same order in the AST as while
        expression = children[0]
        node_condition.add_unparsed_expression(expression)
        statement = self._parse_statement(children[1], node_condition)

    node_endDoWhile = self._new_node(NodeType.ENDLOOP, doWhilestatement["src"])

    link_nodes(node, node_startDoWhile)
    link_nodes(node_startDoWhile, node_condition.sons[0])
    link_nodes(statement, node_condition)
    link_nodes(node_condition, node_endDoWhile)
    return node_endDoWhile


# Traceback (IndexError)
ERROR:root:Traceback (most recent call last):
File "c:\users\vyper\documents\github\slither\slither\__main__.py", line 250, in main_impl
(results, number_contracts) = process(filename, args, detector_classes, printer_classes)
File "c:\users\vyper\documents\github\slither\slither\__main__.py", line 35, in process
slither = Slither(filename, args.solc, args.disable_solc_warnings, args.solc_args, ast)
File "c:\users\vyper\documents\github\slither\slither\slither.py", line 41, in __init__
self._analyze_contracts()
File "c:\users\vyper\documents\github\slither\slither\solc_parsing\slitherSolc.py", line 206, in _analyze_contracts
self._analyze_third_part(contracts_to_be_analyzed, libraries)
File "c:\users\vyper\documents\github\slither\slither\solc_parsing\slitherSolc.py", line 290, in _analyze_third_part
self._analyze_variables_modifiers_functions(contract)
File "c:\users\vyper\documents\github\slither\slither\solc_parsing\slitherSolc.py", line 330, in _analyze_variables_modifiers_functions
contract.analyze_content_functions()
File "c:\users\vyper\documents\github\slither\slither\solc_parsing\declarations\contract.py", line 360, in analyze_content_functions
function.analyze_content()
File "c:\users\vyper\documents\github\slither\slither\solc_parsing\declarations\function.py", line 818, in analyze_content
self._parse_cfg(child)
File "c:\users\vyper\documents\github\slither\slither\solc_parsing\declarations\function.py", line 614, in _parse_cfg
self._parse_block(cfg, node)
File "c:\users\vyper\documents\github\slither\slither\solc_parsing\declarations\function.py", line 595, in _parse_block
node = self._parse_statement(statement, node)
File "c:\users\vyper\documents\github\slither\slither\solc_parsing\declarations\function.py", line 525, in _parse_statement
node = self._parse_dowhile(statement, node)
File "c:\users\vyper\documents\github\slither\slither\solc_parsing\declarations\function.py", line 316, in _parse_dowhile
link_nodes(node_startDoWhile, node_condition.sons[0])
IndexError: list index out of range

# Fixed code
def _parse_dowhile(self, doWhilestatement, node):
    node_startDoWhile = self._new_node(NodeType.STARTLOOP, doWhilestatement["src"])
    node_condition = self._new_node(NodeType.IFLOOP, doWhilestatement["src"])

    if self.is_compact_ast:
        node_condition.add_unparsed_expression(doWhilestatement["condition"])
        statement = self._parse_statement(doWhilestatement["body"], node_condition)
    else:
        children = doWhilestatement[self.get_children("children")]
        # same order in the AST as while
        expression = children[0]
        node_condition.add_unparsed_expression(expression)
        statement = self._parse_statement(children[1], node_condition)

    node_endDoWhile = self._new_node(NodeType.ENDLOOP, doWhilestatement["src"])

    link_nodes(node, node_startDoWhile)
    # empty block, loop from the start to the condition
    if not node_condition.sons:
        link_nodes(node_startDoWhile, node_condition)
    else:
        link_nodes(node_startDoWhile, node_condition.sons[0])
    link_nodes(statement, node_condition)
    link_nodes(node_condition, node_endDoWhile)
    return node_endDoWhile