diff --git a/dlls/comctl32/listview.c b/dlls/comctl32/listview.c index 52ea2d43fbb..94d3c02d21a 100644 --- a/dlls/comctl32/listview.c +++ b/dlls/comctl32/listview.c @@ -1113,8 +1113,13 @@ static RANGE iterator_range(ITERATOR* i) if (!i->ranges) return i->range; - range.lower = (*(RANGE*)DPA_GetPtr(i->ranges->hdpa, 0)).lower; - range.upper = (*(RANGE*)DPA_GetPtr(i->ranges->hdpa, DPA_GetPtrCount(i->ranges->hdpa) - 1)).upper; + if (DPA_GetPtrCount(i->ranges->hdpa) > 0) + { + range.lower = (*(RANGE*)DPA_GetPtr(i->ranges->hdpa, 0)).lower; + range.upper = (*(RANGE*)DPA_GetPtr(i->ranges->hdpa, DPA_GetPtrCount(i->ranges->hdpa) - 1)).upper; + } + else range.lower = range.upper = 0; + return range; }