# Buggy code
def ParseFileTransfer(
    self, parser_mediator, row, cache=None, database=None, query=None, **unused_kwargs
):
    """Parse the transfer files.

     There is no direct relationship between who sends the file and
     who accepts the file.

    Args:
      parser_mediator: A parser mediator object (instance of ParserMediator).
      row: the row with all information related with the file transfers.
      query: Optional query string.
      cache: a cache object (instance of SQLiteCache).
      database: A database object (instance of SQLiteDatabase).
    """
    # Note that pysqlite does not accept a Unicode string in row['string'] and
    # will raise "IndexError: Index must be int or string".

    source_dict = cache.GetResults("source")
    if not source_dict:
        results = database.Query(self.QUERY_SOURCE_FROM_TRANSFER)

        # Note that pysqlite does not accept a Unicode string in row['string'] and
        # will raise "IndexError: Index must be int or string".
        cache.CacheQueryResults(results, "source", "pk_id", ("skypeid", "skypename"))
        source_dict = cache.GetResults("source")

    dest_dict = cache.GetResults("destination")
    if not dest_dict:
        results = database.Query(self.QUERY_DEST_FROM_TRANSFER)

        # Note that pysqlite does not accept a Unicode string in row['string'] and
        # will raise "IndexError: Index must be int or string".
        cache.CacheQueryResults(
            results, "destination", "parent_id", ("skypeid", "skypename")
        )
        dest_dict = cache.GetResults("destination")

    source = "Unknown"
    destination = "Unknown"

    if row["parent_id"]:
        destination = "{0:s} <{1:s}>".format(
            row["partner_handle"], row["partner_dispname"]
        )
        skype_id, skype_name = source_dict.get(row["parent_id"], [None, None])
        if skype_name:
            source = "{0:s} <{1:s}>".format(skype_id, skype_name)
    else:
        source = "{0:s} <{1:s}>".format(row["partner_handle"], row["partner_dispname"])

        if row["pk_id"]:
            skype_id, skype_name = dest_dict.get(row["pk_id"], [None, None])
            if skype_name:
                destination = "{0:s} <{1:s}>".format(skype_id, skype_name)

    if row["status"] == 8:
        if row["starttime"]:
            event_object = SkypeTransferFileEvent(
                row, row["starttime"], "GETSOLICITUDE", source, destination
            )
            parser_mediator.ProduceEvent(event_object, query=query)

        if row["accepttime"]:
            event_object = SkypeTransferFileEvent(
                row, row["accepttime"], "ACCEPTED", source, destination
            )
            parser_mediator.ProduceEvent(event_object, query=query)

        if row["finishtime"]:
            event_object = SkypeTransferFileEvent(
                row, row["finishtime"], "FINISHED", source, destination
            )
            parser_mediator.ProduceEvent(event_object, query=query)

    elif row["status"] == 2 and row["starttime"]:
        event_object = SkypeTransferFileEvent(
            row, row["starttime"], "SENDSOLICITUDE", source, destination
        )
        parser_mediator.ProduceEvent(event_object, query=query)


# Traceback (AttributeError)
Traceback (most recent call last):
File "plaso\engine\worker.py", line 684, in _ProcessPathSpec
File "plaso\engine\worker.py", line 636, in _ProcessFileEntry
File "plaso\engine\worker.py", line 555, in _ProcessDataStream
File "plaso\engine\worker.py", line 353, in _ParseFileEntryWithParser
File "plaso\parsers\interface.py", line 288, in Parse
File "plaso\parsers\sqlite.py", line 268, in ParseFileObject
File "plaso\parsers\plugins.py", line 88, in UpdateChainAndProcess
File "plaso\parsers\sqlite_plugins\interface.py", line 89, in Process
File "plaso\parsers\sqlite_plugins\interface.py", line 52, in GetEntries
File "plaso\parsers\sqlite_plugins\skype.py", line 299, in ParseSMS
AttributeError: 'NoneType' object has no attribute 'replace'

# Fixed code
def ParseFileTransfer(
    self, parser_mediator, row, cache=None, database=None, query=None, **unused_kwargs
):
    """Parse the transfer files.

     There is no direct relationship between who sends the file and
     who accepts the file.

    Args:
      parser_mediator: A parser mediator object (instance of ParserMediator).
      row: the row with all information related with the file transfers.
      query: Optional query string.
      cache: a cache object (instance of SQLiteCache).
      database: A database object (instance of SQLiteDatabase).
    """
    # Note that pysqlite does not accept a Unicode string in row['string'] and
    # will raise "IndexError: Index must be int or string".

    source_dict = cache.GetResults("source")
    if not source_dict:
        results = database.Query(self.QUERY_SOURCE_FROM_TRANSFER)

        # Note that pysqlite does not accept a Unicode string in row['string'] and
        # will raise "IndexError: Index must be int or string".
        cache.CacheQueryResults(results, "source", "pk_id", ("skypeid", "skypename"))
        source_dict = cache.GetResults("source")

    dest_dict = cache.GetResults("destination")
    if not dest_dict:
        results = database.Query(self.QUERY_DEST_FROM_TRANSFER)

        # Note that pysqlite does not accept a Unicode string in row['string'] and
        # will raise "IndexError: Index must be int or string".
        cache.CacheQueryResults(
            results, "destination", "parent_id", ("skypeid", "skypename")
        )
        dest_dict = cache.GetResults("destination")

    source = "Unknown"
    destination = "Unknown"

    if row["parent_id"]:
        destination = "{0:s} <{1:s}>".format(
            row["partner_handle"], row["partner_dispname"]
        )
        skype_id, skype_name = source_dict.get(row["parent_id"], [None, None])
        if skype_name:
            source = "{0:s} <{1:s}>".format(skype_id, skype_name)
    else:
        source = "{0:s} <{1:s}>".format(row["partner_handle"], row["partner_dispname"])

        if row["pk_id"]:
            skype_id, skype_name = dest_dict.get(row["pk_id"], [None, None])
            if skype_name:
                destination = "{0:s} <{1:s}>".format(skype_id, skype_name)

    try:
        # TODO: add a conversion base.
        file_size = int(row["filesize"])
    except ValueError:
        parser_mediator.ProduceParseError(
            "unable to convert file size: {0!s} of file: {1:s}".format(
                row["filesize"], row["filename"]
            )
        )
        file_size = 0

    if row["status"] == 8:
        if row["starttime"]:
            event_object = SkypeTransferFileEvent(
                row["starttime"],
                row["id"],
                "GETSOLICITUDE",
                source,
                destination,
                row["filename"],
                row["filepath"],
                file_size,
            )
            parser_mediator.ProduceEvent(event_object, query=query)

        if row["accepttime"]:
            event_object = SkypeTransferFileEvent(
                row["accepttime"],
                row["id"],
                "ACCEPTED",
                source,
                destination,
                row["filename"],
                row["filepath"],
                file_size,
            )
            parser_mediator.ProduceEvent(event_object, query=query)

        if row["finishtime"]:
            event_object = SkypeTransferFileEvent(
                row["finishtime"],
                row["id"],
                "FINISHED",
                source,
                destination,
                row["filename"],
                row["filepath"],
                file_size,
            )
            parser_mediator.ProduceEvent(event_object, query=query)

    elif row["status"] == 2 and row["starttime"]:
        event_object = SkypeTransferFileEvent(
            row["starttime"],
            row["id"],
            "SENDSOLICITUDE",
            source,
            destination,
            row["filename"],
            row["filepath"],
            file_size,
        )
        parser_mediator.ProduceEvent(event_object, query=query)