summaryrefslogtreecommitdiff
path: root/mbutil.c
diff options
context:
space:
mode:
Diffstat (limited to 'mbutil.c')
-rw-r--r--mbutil.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/mbutil.c b/mbutil.c
index 9a8f17c..695845a 100644
--- a/mbutil.c
+++ b/mbutil.c
@@ -126,11 +126,11 @@ _rl_find_next_mbchar_internal (string, seed, count, find_non_zero)
if (find_non_zero)
{
tmp = mbrtowc (&wc, string + point, strlen (string + point), &ps);
- while (wcwidth (wc) == 0)
+ while (tmp > 0 && wcwidth (wc) == 0)
{
point += tmp;
tmp = mbrtowc (&wc, string + point, strlen (string + point), &ps);
- if (tmp == (size_t)(0) || tmp == (size_t)(-1) || tmp == (size_t)(-2))
+ if (MB_NULLWCH (tmp) || MB_INVALIDCH (tmp))
break;
}
}