# Buggy code
def object_log(self):
    result = []
    for i, (date, content, unused_com) in enumerate(self.parse()):
        # Based on Mateusz's code; provides more details about the
        # history event
        event = {
            "date": date,
            "rev": i,
            "install": [],
            "remove": [],
            "upgrade": [],
            "downgrade": [],
        }
        added = {}
        removed = {}
        if is_diff(content):
            for pkg in content:
                name, version, build = dist2quad(pkg[1:], channel=False)
                if pkg.startswith("+"):
                    added[name.lower()] = (version, build)
                elif pkg.startswith("-"):
                    removed[name.lower()] = (version, build)

            changed = set(added) & set(removed)
            for name in sorted(changed):
                old = removed[name]
                new = added[name]
                details = {
                    "old": "-".join((name,) + old),
                    "new": "-".join((name,) + new),
                }

                if new > old:
                    event["upgrade"].append(details)
                else:
                    event["downgrade"].append(details)

            for name in sorted(set(removed) - changed):
                event["remove"].append("-".join((name,) + removed[name]))

            for name in sorted(set(added) - changed):
                event["install"].append("-".join((name,) + added[name]))
        else:
            for pkg in sorted(content):
                event["install"].append(pkg)
        result.append(event)
    return result


# Traceback (TypeError)
Traceback (most recent call last):
File "/home/ilan/minonda/bin/conda", line 6, in <module>
sys.exit(main())
File "/home/ilan/conda/conda/cli/main.py", line 120, in main
args_func(args, p)
File "/home/ilan/conda/conda/cli/main.py", line 127, in args_func
args.func(args, p)
File "/home/ilan/conda/conda/cli/main_install.py", line 62, in execute
install.install(args, parser, 'install')
File "/home/ilan/conda/conda/cli/install.py", line 394, in install
plan.execute_actions(actions, index, verbose=not args.quiet)
File "/home/ilan/conda/conda/plan.py", line 555, in execute_actions
inst.execute_instructions(plan, index, verbose)
File "/home/ilan/conda/conda/instructions.py", line 133, in execute_instructions
cmd(state, arg)
File "/home/ilan/conda/conda/instructions.py", line 80, in UNLINK_CMD
install.unlink(state['prefix'], arg)
File "/home/ilan/conda/conda/install.py", line 1075, in unlink
mk_menus(prefix, meta['files'], remove=True)
TypeError: 'NoneType' object has no attribute '__getitem__'

# Fixed code
def object_log(self):
    result = []
    for i, (date, content, unused_com) in enumerate(self.parse()):
        # Based on Mateusz's code; provides more details about the
        # history event
        event = {
            "date": date,
            "rev": i,
            "install": [],
            "remove": [],
            "upgrade": [],
            "downgrade": [],
        }
        added = {}
        removed = {}
        if is_diff(content):
            for pkg in content:
                name, version, build, channel = dist2quad(pkg[1:])
                if pkg.startswith("+"):
                    added[name.lower()] = (version, build, channel)
                elif pkg.startswith("-"):
                    removed[name.lower()] = (version, build, channel)

            changed = set(added) & set(removed)
            for name in sorted(changed):
                old = removed[name]
                new = added[name]
                details = {
                    "old": "-".join((name,) + old),
                    "new": "-".join((name,) + new),
                }

                if new > old:
                    event["upgrade"].append(details)
                else:
                    event["downgrade"].append(details)

            for name in sorted(set(removed) - changed):
                event["remove"].append("-".join((name,) + removed[name]))

            for name in sorted(set(added) - changed):
                event["install"].append("-".join((name,) + added[name]))
        else:
            for pkg in sorted(content):
                event["install"].append(pkg)
        result.append(event)
    return result