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 GitHub
parent 2baadd1e90
commit b9781c4903
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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());
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);
journal->RecordEntry(0, journal::Op::EXPIRED, db_ind, 1, make_pair("DEL", delete_args),
false);
}
}
auto time_finish = absl::GetCurrentTimeNanos();