"data" will never be NULL, so you can't use it to detect a sublist. You need a separate type member.