tools/generate-wire.py: unmarshall zero-length arrays as NULL.

This is symmetrical with marshalling.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell 2017-06-26 10:39:49 +09:30
parent da18645901
commit be6347b814
1 changed files with 2 additions and 2 deletions

View File

@ -289,8 +289,8 @@ class Message(object):
f.num_elems)
elif f.is_variable_size():
subcalls.append("\t//2th case {name}".format(name=f.name))
subcalls.append('\t*{} = tal_arr(ctx, {}, {});'
.format(f.name, f.fieldtype.name, f.lenvar))
subcalls.append('\t*{} = {} ? tal_arr(ctx, {}, {}) : NULL;'
.format(f.name, f.lenvar, f.fieldtype.name, f.lenvar))
self.print_fromwire_array(subcalls, basetype, f, '*'+f.name,
f.lenvar)