copytrace: packet_context is optional
[babeltrace.git] / plugins / libctfcopytrace / ctfcopytrace.c
index 5c78d6f8c968b89f7ed665e8d77eef620200c48e..b50783ccae81f4cff05871f637d84530de388320 100644 (file)
@@ -398,20 +398,16 @@ struct bt_ctf_stream_class *ctf_copy_stream_class(FILE *err,
        }
 
        type = bt_ctf_stream_class_get_packet_context_type(stream_class);
-       if (!type) {
-               fprintf(err, "[error] %s in %s:%d\n", __func__, __FILE__,
-                               __LINE__);
-               goto error;
-       }
-
-       ret_int = bt_ctf_stream_class_set_packet_context_type(
-                       writer_stream_class, type);
-       if (ret_int < 0) {
-               fprintf(err, "[error] %s in %s:%d\n", __func__, __FILE__,
-                               __LINE__);
-               goto error;
+       if (type) {
+               ret_int = bt_ctf_stream_class_set_packet_context_type(
+                               writer_stream_class, type);
+               if (ret_int < 0) {
+                       fprintf(err, "[error] %s in %s:%d\n", __func__,
+                                       __FILE__, __LINE__);
+                       goto error;
+               }
+               BT_PUT(type);
        }
-       BT_PUT(type);
 
        type = bt_ctf_stream_class_get_event_header_type(stream_class);
        if (!type) {
This page took 0.024667 seconds and 4 git commands to generate.