~nabijaczleweli/klapki

3ec7855f5cbb5922d80dcecebcd2fe7ec236f5cd — наб 1 year, 8 months ago 10a2744 v0.2.2
Don't segfault on commit if there are no boot entries

Very rare, especially since firmwares usually add their own stuff,
but some (like my laptop) only on reboot
2 files changed, 1 insertions(+), 1 deletions(-)

M src/state_commit.cpp
M test-data/state_parse/exempli-gratia -rwxr-xr-x => -rw-r--r--
M src/state_commit.cpp => src/state_commit.cpp +1 -1
@@ 68,7 68,7 @@ std::optional<std::string> klapki::state::state::commit(std::string_view us, con
	                   this->order, original_state.order));


	const auto max_bootnum = std::max(this->entries.rbegin()->first, original_state.entries.rbegin()->first);
	const auto max_bootnum = std::max(this->entries.rbegin()->first, original_state.entries.empty() ? static_cast<std::uint16_t>(0) : original_state.entries.rbegin()->first);
	for(std::size_t i = 0; i <= max_bootnum; ++i) {
		const auto now  = this->entries.find(i);
		const auto orig = original_state.entries.find(i);

M test-data/state_parse/exempli-gratia => test-data/state_parse/exempli-gratia +0 -0