Handle case where iterator range contains 0 elements.
diff --git a/dlls/comctl32/listview.c b/dlls/comctl32/listview.c
index 52ea2d4..94d3c02 100644
--- a/dlls/comctl32/listview.c
+++ b/dlls/comctl32/listview.c
@@ -1113,8 +1113,13 @@
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;
}