From 4d213a1f90dd1b2f285947cf959f617f85ca5d98 Mon Sep 17 00:00:00 2001 From: Disconnect3d Date: Wed, 20 Jan 2021 07:51:53 -0500 Subject: [PATCH] Fix #881 (#883) --- pwndbg/commands/context.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pwndbg/commands/context.py b/pwndbg/commands/context.py index 3c9aa0112..28678017a 100644 --- a/pwndbg/commands/context.py +++ b/pwndbg/commands/context.py @@ -476,9 +476,10 @@ def context_disasm(target=sys.stdout, with_banner=True, width=None): syntax = pwndbg.disasm.CapstoneSyntax[flavor] # Get the Capstone object to set disassembly syntax - cs = next(iter(pwndbg.disasm.get_disassembler_cached.cache.values())) + cs = next(iter(pwndbg.disasm.get_disassembler_cached.cache.values()), None) - if cs.syntax != syntax: + # The `None` case happens when the cache was not filled yet (see e.g. #881) + if cs is not None and cs.syntax != syntax: pwndbg.memoize.reset() banner = [pwndbg.ui.banner("disasm", target=target, width=width)]