summaryrefslogtreecommitdiffstats
path: root/src/ex_eval.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/ex_eval.c')
-rw-r--r--src/ex_eval.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/ex_eval.c b/src/ex_eval.c
index e3c544b892..9a2792a2ac 100644
--- a/src/ex_eval.c
+++ b/src/ex_eval.c
@@ -1146,7 +1146,12 @@ ex_else(exarg_T *eap)
if (eap->cmdidx == CMD_elseif)
{
- result = eval_to_bool(eap->arg, &error, eap, skip);
+ // When skipping we ignore most errors, but a missing expression is
+ // wrong, perhaps it should have been "else".
+ if (skip && ends_excmd(*eap->arg))
+ semsg(_(e_invalid_expression_str), eap->arg);
+ else
+ result = eval_to_bool(eap->arg, &error, eap, skip);
// When throwing error exceptions, we want to throw always the first
// of several errors in a row. This is what actually happens when