# Buggy code
def _process_Stmt(self, whitelist=None):
    if whitelist is not None:
        # optimize whitelist lookups
        whitelist = set(whitelist)

    for stmt_idx, stmt in enumerate(self.block.vex.statements):
        if whitelist is not None and stmt_idx not in whitelist:
            continue
        self.stmt_idx = stmt_idx

        if type(stmt) is pyvex.IRStmt.IMark:
            # Note that we cannot skip IMarks as they are used later to trigger observation events
            # The bug caused by skipping IMarks is reported at https://github.com/angr/angr/pull/1150
            self.ins_addr = stmt.addr + stmt.delta

        self._handle_Stmt(stmt)

    if self.block.vex.jumpkind == "Ijk_Call":
        handler = "_handle_function"
        if hasattr(self, handler):
            getattr(self, handler)(self._expr(self.block.vex.next))
        else:
            self.l.warning("Function handler not implemented.")


# Traceback (TypeError)
<...>
DEBUG   | 2019-11-25 16:04:47,177 | angr.analyses.cfg.cfg_fast | 	Function __libc_csu_init
ERROR   | 2019-11-25 16:04:47,198 | angr.analyses.cfg.cfg_fast | Error collecting XRefs for function __libc_csu_init.
Traceback (most recent call last):
File "/usr/local/lib/python3.6/dist-packages/angr/analyses/cfg/cfg_fast.py", line 1259, in _do_full_xrefs
prop = self.project.analyses.Propagator(func=f, base_state=state)
File "/usr/local/lib/python3.6/dist-packages/angr/analyses/analysis.py", line 109, in __call__
oself.__init__(*args, **kwargs)
File "/usr/local/lib/python3.6/dist-packages/angr/analyses/propagator/propagator.py", line 222, in __init__
self._analyze()
File "/usr/local/lib/python3.6/dist-packages/angr/analyses/forward_analysis/__init__.py", line 223, in _analyze
self._analysis_core_graph()
File "/usr/local/lib/python3.6/dist-packages/angr/analyses/forward_analysis/__init__.py", line 246, in _analysis_core_graph
changed, output_state = self._run_on_node(n, job_state)
File "/usr/local/lib/python3.6/dist-packages/angr/analyses/propagator/propagator.py", line 263, in _run_on_node
load_callback=self._load_callback, fail_fast=self._fail_fast)
File "/usr/local/lib/python3.6/dist-packages/angr/analyses/propagator/engine_base.py", line 27, in process
self._process(state, None, block=kwargs.pop('block', None))
File "/usr/local/lib/python3.6/dist-packages/angr/analyses/propagator/engine_vex.py", line 25, in _process
super()._process(state, successors, block=block, whitelist=whitelist, **kwargs)
File "/usr/local/lib/python3.6/dist-packages/angr/engines/light/engine.py", line 69, in _process
self._process_Stmt(whitelist=whitelist)
File "/usr/local/lib/python3.6/dist-packages/angr/engines/light/engine.py", line 95, in _process_Stmt
getattr(self, handler)(self._expr(self.block.vex.next))
File "/usr/local/lib/python3.6/dist-packages/angr/analyses/propagator/engine_vex.py", line 76, in _handle_function
b = self._project.loader.memory.load(addr, 4)
File "/usr/local/lib/python3.6/dist-packages/cle/memory.py", line 204, in load
for start, backer in self.backers(addr):
File "/usr/local/lib/python3.6/dist-packages/cle/memory.py", line 176, in backers
started = addr <= 0
TypeError: '<=' not supported between instances of 'NoneType' and 'int'
DEBUG   | 2019-11-25 16:04:47,199 | angr.analyses.cfg.cfg_fast | 	Function sub_804865d
<...>

# Fixed code
def _process_Stmt(self, whitelist=None):
    if whitelist is not None:
        # optimize whitelist lookups
        whitelist = set(whitelist)

    for stmt_idx, stmt in enumerate(self.block.vex.statements):
        if whitelist is not None and stmt_idx not in whitelist:
            continue
        self.stmt_idx = stmt_idx

        if type(stmt) is pyvex.IRStmt.IMark:
            # Note that we cannot skip IMarks as they are used later to trigger observation events
            # The bug caused by skipping IMarks is reported at https://github.com/angr/angr/pull/1150
            self.ins_addr = stmt.addr + stmt.delta

        self._handle_Stmt(stmt)

    if self.block.vex.jumpkind == "Ijk_Call":
        handler = "_handle_function"
        if hasattr(self, handler):
            func_addr = self._expr(self.block.vex.next)
            if func_addr is not None:
                getattr(self, handler)(func_addr)
            else:
                self.l.debug(
                    "Cannot determine the callee address at %#x.", self.block.addr
                )
        else:
            self.l.warning("Function handler not implemented.")