Detect empty selection lists when restoring selections from registers

Fixes #1123
This commit is contained in:
Maxime Coste 2017-01-11 13:43:41 +00:00
parent 394b962524
commit 8c55acb076

View File

@ -1436,6 +1436,9 @@ SelectionList read_selections_from_register(char reg, Context& context)
for (auto sel_desc : StringView{desc.begin(), arobase} | split<StringView>(':')) for (auto sel_desc : StringView{desc.begin(), arobase} | split<StringView>(':'))
sels.push_back(selection_from_string(sel_desc)); sels.push_back(selection_from_string(sel_desc));
if (sels.empty())
throw runtime_error(format("Register {} contains an empty selection list", reg));
return {buffer, std::move(sels), timestamp}; return {buffer, std::move(sels), timestamp};
} }