aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/nvim/ops.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/nvim/ops.c b/src/nvim/ops.c
index 5ba1d8b2f5..b3e889c0ec 100644
--- a/src/nvim/ops.c
+++ b/src/nvim/ops.c
@@ -5336,11 +5336,11 @@ const void *op_register_iter(const void *const iter, char *const name,
const yankreg_T *iter_reg = (iter == NULL
? &(y_regs[0])
: (const yankreg_T *const) iter);
- while (reg_empty(iter_reg) && iter_reg - &(y_regs[0]) < NUM_SAVED_REGISTERS) {
+ while (iter_reg - &(y_regs[0]) < NUM_SAVED_REGISTERS && reg_empty(iter_reg)) {
iter_reg++;
}
- if (reg_empty(iter_reg)) {
- *reg = (yankreg_T) {.y_array = NULL};
+ if (iter_reg - &(y_regs[0]) == NUM_SAVED_REGISTERS || reg_empty(iter_reg)) {
+ *reg = (yankreg_T) { .y_array = NULL };
return NULL;
}
size_t iter_off = iter_reg - &(y_regs[0]);