Skip to content

Commit d77e746

Browse files
acceleratedmfontanini
authored andcommitted
changed assert with if statement (#116)
1 parent f458514 commit d77e746

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

Diff for: include/cppkafka/utils/buffered_producer.h

+4-3
Original file line numberDiff line numberDiff line change
@@ -849,9 +849,10 @@ void BufferedProducer<BufferType>::on_delivery_report(const Message& message) {
849849
if (tracker) {
850850
tracker->should_retry_.set_value(should_retry);
851851
}
852-
// Decrement the expected acks
853-
--pending_acks_;
854-
assert(pending_acks_ != (size_t)-1); // Prevent underflow
852+
// Decrement the expected acks and check to prevent underflow
853+
if (pending_acks_ > 0) {
854+
--pending_acks_;
855+
}
855856
}
856857

857858
} // cppkafka

0 commit comments

Comments
 (0)