diff --git a/include/cppkafka/message.h b/include/cppkafka/message.h index f8101a04..db5484ef 100644 --- a/include/cppkafka/message.h +++ b/include/cppkafka/message.h @@ -108,7 +108,7 @@ class CPPKAFKA_API Message { */ std::string get_topic() const { assert(handle_); - return rd_kafka_topic_name(handle_->rkt); + return handle_->rkt ? rd_kafka_topic_name(handle_->rkt) : std::string{}; } /**