Skip to content

Commit 6058a27

Browse files
authored
unirec2json: bugfix failure if -M is missing (#235)
apply_mapping() is called only when a -M parameter was provided.
1 parent d4f4969 commit 6058a27

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

unirec2json/unirec2json.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,9 @@ def apply_mappings(data, mapping):
7979
trap.sendFlush(0)
8080
break
8181
rec.setData(data)
82-
d = apply_mappings(rec.getDict(), mapping)
82+
d = rec.getDict()
83+
if mapping:
84+
d = apply_mappings(d, mapping)
8385
j = json.dumps(d, default=default)
8486
if options.verbose:
8587
print(j)

0 commit comments

Comments
 (0)