Log(e.g., projected_log) could theoretically be emtpy and hence there might
be potential access violation.
Signed-off-by: xie xingguo <xie.xingguo@zte.com.cn>
// reset complete_to to the beginning of the log
if (reset_complete_to) {
- lgeneric_subdout(cct, osd, 20) << " moving complete_to " << " to "
- << log.begin()->version << dendl;
complete_to = log.begin();
+ if (complete_to != log.end()) {
+ lgeneric_subdout(cct, osd, 20) << " moving complete_to to "
+ << log.begin()->version << dendl;
+ } else {
+ lgeneric_subdout(cct, osd, 20) << " log is now empty" << dendl;
+ }
}
}