Skip to content

Commit d3d19fe

Browse files
committed
CLI: Handle BaseAbsentValues in JSON
1 parent aad6a56 commit d3d19fe

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

volatility3/cli/text_renderer.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -535,10 +535,18 @@ def tab_stop(self, line: str) -> str:
535535

536536
class JsonRenderer(CLIRenderer):
537537
_type_renderers = {
538-
format_hints.HexBytes: lambda x: x.hex(" "),
538+
format_hints.HexBytes: lambda x: (
539+
x.hex(" ")
540+
if not isinstance(x, interfaces.renderers.BaseAbsentValue)
541+
else "N/A"
542+
),
539543
renderers.Disassembly: quoted_optional(display_disassembly),
540544
format_hints.MultiTypeData: quoted_optional(multitypedata_as_text),
541-
renderers.LayerData: lambda x: LayerDataRenderer().render_bytes(x)[0].hex(" "),
545+
renderers.LayerData: lambda x: (
546+
LayerDataRenderer().render_bytes(x)[0].hex(" ")
547+
if not isinstance(x, interfaces.renderers.BaseAbsentValue)
548+
else "N/A"
549+
),
542550
bytes: optional(lambda x: " ".join(f"{b:02x}" for b in x)),
543551
datetime.datetime: lambda x: (
544552
x.isoformat()

0 commit comments

Comments
 (0)