From 8c55acb07659d7406b4077b9e3a5bbe9cc035d21 Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Wed, 11 Jan 2017 13:43:41 +0000 Subject: [PATCH] Detect empty selection lists when restoring selections from registers Fixes #1123 --- src/normal.cc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/normal.cc b/src/normal.cc index 761af327..fec35a49 100644 --- a/src/normal.cc +++ b/src/normal.cc @@ -1436,6 +1436,9 @@ SelectionList read_selections_from_register(char reg, Context& context) for (auto sel_desc : StringView{desc.begin(), arobase} | split(':')) 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}; }