Error when trying to run an empty register as a macro

This commit is contained in:
Maxime Coste 2015-09-22 19:01:24 +01:00
parent 7750df787a
commit 3c000cbd0d

View File

@ -1084,8 +1084,9 @@ void replay_macro(Context& context, NormalParams params)
throw runtime_error("recursive macros call detected"); throw runtime_error("recursive macros call detected");
ConstArrayView<String> reg_val = RegisterManager::instance()[reg].values(context); ConstArrayView<String> reg_val = RegisterManager::instance()[reg].values(context);
if (not reg_val.empty()) if (reg_val.empty() or reg_val[0].empty())
{ throw runtime_error(format("Register '{}' is empty", reg));
running_macros[idx] = true; running_macros[idx] = true;
auto stop = on_scope_end([&]{ running_macros[idx] = false; }); auto stop = on_scope_end([&]{ running_macros[idx] = false; });
@ -1093,7 +1094,6 @@ void replay_macro(Context& context, NormalParams params)
ScopedEdition edition(context); ScopedEdition edition(context);
do { exec_keys(keys, context); } while (--params.count > 0); do { exec_keys(keys, context); } while (--params.count > 0);
} }
}
template<Direction direction> template<Direction direction>
void jump(Context& context, NormalParams) void jump(Context& context, NormalParams)