hideakitai / MsgPack

MessagePack implementation for Arduino (compatible with other C++ apps) / msgpack.org[Arduino]
MIT License
56 stars 3 forks source link

Can't unpack empty arrays? #19

Open rcross-lc opened 2 months ago

rcross-lc commented 2 months ago

Why can't this library unpack empty array?

These lines seem to stop this case

The test sequence is simply "0x90" which should be a valid msgpack structure, but I get

[ERROR] Unpacker.h L.1944 unpackArrayContainerArray : array size mismatch: 0 must be 0

rcross-lc commented 2 months ago

If I simply remove the size == 0 check, everything seems to work just fine.

rcross-lc commented 2 months ago

I suspect maybe the size == 0 case is checking for the default initialized type_error() that can be returned by unpackArraySize?

Maybe check if(!b_decode_success) instead of if(size == 0)?

the type_error should set b_decode_success to false

hideakitai commented 1 month ago

@rcross-lc Sorry for not getting back to you sooner. This issue is one of several known problems. I have not had time to address it and have not yet been able to fix it, but I will try to do so later.