1
0
Fork 0
mirror of https://github.com/dragonflydb/dragonfly.git synced 2024-12-14 11:58:02 +00:00

fix(test): Don't access null pointer (#2126)

This caused a UBSan warning to be printed in test `DflyEngineTest.Bug207`

```
/usr/include/c++/11/bits/stl_vector.h:1046:34: runtime error: reference binding to null pointer of type 'struct value_type'
```
This commit is contained in:
Shahar Mike 2023-11-05 13:31:28 +02:00 committed by Roman Gershman
parent d7cd65ce1f
commit ac457a64e4
No known key found for this signature in database
GPG key ID: F25B77EAF8AEBA7A

View file

@ -1183,9 +1183,12 @@ finish:
// send the deletion to the replicas.
// fiber preemption could happen in this phase.
vector<string_view> args(keys_to_journal.begin(), keys_to_journal.end());
ArgSlice delete_args(&args[0], args.size());
if (auto journal = owner_->journal(); journal) {
journal->RecordEntry(0, journal::Op::EXPIRED, db_ind, 1, make_pair("DEL", delete_args), false);
if (!args.empty()) {
ArgSlice delete_args(&args[0], args.size());
if (auto journal = owner_->journal(); journal) {
journal->RecordEntry(0, journal::Op::EXPIRED, db_ind, 1, make_pair("DEL", delete_args),
false);
}
}
auto time_finish = absl::GetCurrentTimeNanos();