diff --git a/dlls/mshtml/txtrange.c b/dlls/mshtml/txtrange.c
index 3f383d1..f03170d 100644
--- a/dlls/mshtml/txtrange.c
+++ b/dlls/mshtml/txtrange.c
@@ -797,7 +797,7 @@ static long move_next_chars(long cnt, const dompos_t *pos, BOOL col, const dompo
break;
ret++;
- if(bound_pos && dompos_cmp(&tmp, bound_pos)) {
+ if(bounded && bound_pos && dompos_cmp(&tmp, bound_pos)) {
*bounded = TRUE;
ret++;
}