# Buggy code
def _ProcessPathSpec(self, path_spec):
    """Processes a path specification.

    Args:
      path_spec: A path specification object (instance of dfvfs.PathSpec).
    """
    try:
        file_entry = path_spec_resolver.Resolver.OpenFileEntry(
            path_spec, resolver_context=self._resolver_context
        )

        if file_entry is None:
            logging.warning(
                "Unable to open file entry with path spec: {0:s}".format(
                    path_spec.comparable
                )
            )
            return

        self._ProcessFileEntry(file_entry)

    except IOError as exception:
        logging.warning(
            "Unable to process path spec: {0:s} with error: {1:s}".format(
                path_spec.comparable, exception
            )
        )

    except dfvfs_errors.CacheFullError:
        # TODO: signal engine of failure.
        self._abort = True
        logging.error(
            (
                "ABORT: detected cache full error while processing path spec: {0:s}"
            ).format(path_spec.comparable)
        )

    # All exceptions need to be caught here to prevent the worker
    # form being killed by an uncaught exception.
    except Exception as exception:
        logging.warning(
            "Unhandled exception while processing path spec: {0:s}.".format(
                path_spec.comparable
            )
        )
        logging.exception(exception)

    # Make sure frame.f_locals does not keep a reference to file_entry.
    file_entry = None


# Traceback (AttributeError)
2015-08-26 10:45:34,469 [WARNING] (Worker_04 ) PID:21019 <worker> Unhandled exception while processing path spec: type: OS, location: <PATH>/test.dd
type: VHDI
type: TSK_PARTITION, location: /p1, part index: 2, start offset: 0x00007e00
type: TSK, inode: 377, location: /Documents and Settings/NetworkService/ntuser.dat.LOG
.
2015-08-26 10:45:34,470 [ERROR] (Worker_04 ) PID:21019 <worker> 'NoneType' object has no attribute 'values'
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/plaso-1.3.1_20150826-py2.7.egg/plaso/engine/worker.py", line 471, in _ProcessPathSpec
File "/usr/local/lib/python2.7/dist-packages/plaso-1.3.1_20150826-py2.7.egg/plaso/engine/worker.py", line 430, in _ProcessFileEntry
File "/usr/local/lib/python2.7/dist-packages/plaso-1.3.1_20150826-py2.7.egg/plaso/engine/worker.py", line 213, in _ParseFileEntryWithParser
File "/usr/local/lib/python2.7/dist-packages/plaso-1.3.1_20150826-py2.7.egg/plaso/parsers/interface.py", line 72, in UpdateChainAndParse
File "/usr/local/lib/python2.7/dist-packages/plaso-1.3.1_20150826-py2.7.egg/plaso/parsers/winreg.py", line 318, in Parse
File "/usr/local/lib/python2.7/dist-packages/plaso-1.3.1_20150826-py2.7.egg/plaso/parsers/winreg.py", line 264, in _ParseRegistryFile
File "/usr/local/lib/python2.7/dist-packages/plaso-1.3.1_20150826-py2.7.egg/plaso/parsers/plugins.py", line 85, in UpdateChainAndProcess
File "/usr/local/lib/python2.7/dist-packages/plaso-1.3.1_20150826-py2.7.egg/plaso/parsers/winreg_plugins/mrulist.py", line 192, in Process
File "/usr/local/lib/python2.7/dist-packages/plaso-1.3.1_20150826-py2.7.egg/plaso/parsers/winreg_plugins/interface.py", line 211, in Process
File "/usr/local/lib/python2.7/dist-packages/plaso-1.3.1_20150826-py2.7.egg/plaso/dfwinreg/regf.py", line 166, in GetValues
AttributeError: 'NoneType' object has no attribute 'values'

# Fixed code
def _ProcessPathSpec(self, path_spec):
    """Processes a path specification.

    Args:
      path_spec: A path specification object (instance of dfvfs.PathSpec).
    """
    try:
        file_entry = path_spec_resolver.Resolver.OpenFileEntry(
            path_spec, resolver_context=self._resolver_context
        )

        if file_entry is None:
            logging.warning(
                "Unable to open file entry with path spec: {0:s}".format(
                    path_spec.comparable
                )
            )
            return

        self._ProcessFileEntry(file_entry)

    except IOError as exception:
        logging.warning(
            "Unable to process path spec: {0:s} with error: {1:s}".format(
                path_spec.comparable, exception
            )
        )

    except dfvfs_errors.CacheFullError:
        # TODO: signal engine of failure.
        self._abort = True
        logging.error(
            (
                "ABORT: detected cache full error while processing path spec: {0:s}"
            ).format(path_spec.comparable)
        )

    # All exceptions need to be caught here to prevent the worker
    # form being killed by an uncaught exception.
    except Exception as exception:
        logging.warning(
            "Unhandled exception while processing path spec: {0:s}.".format(
                path_spec.comparable
            )
        )
        logging.exception(exception)
        # TODO: Issue #314 - add a signal to the worker to indicate that
        # the tool is run in single process mode with debug turned on and
        # in that case start a pdb debugger here instead of just logging
        # the exception.

    # Make sure frame.f_locals does not keep a reference to file_entry.
    file_entry = None