Diagnose empty selection desc string

Fixes #690
This commit is contained in:
Maxime Coste 2016-06-06 17:17:18 +01:00
parent 98b0560335
commit e2bfd9e3b2

View File

@ -594,6 +594,9 @@ Selection selection_from_string(StringView desc)
SelectionList selection_list_from_string(Buffer& buffer, StringView desc) SelectionList selection_list_from_string(Buffer& buffer, StringView desc)
{ {
if (desc.empty())
throw runtime_error{"empty selection description"};
Vector<Selection> sels; Vector<Selection> sels;
for (auto sel_desc : desc | split<StringView>(':')) for (auto sel_desc : desc | split<StringView>(':'))
sels.push_back(selection_from_string(sel_desc)); sels.push_back(selection_from_string(sel_desc));