- /* packet_header_type must be a structure */
- if (bt_ctf_field_type_get_type_id(packet_header_type) !=
- BT_CTF_TYPE_ID_STRUCT) {
+ /* packet_header_type must be a structure. */
+ if (packet_header_type &&
+ bt_ctf_field_type_get_type_id(packet_header_type) !=
+ BT_CTF_TYPE_ID_STRUCT) {