diff --git a/posting/list.go b/posting/list.go
index 92a56e2ec1850ae92f8fd7e926d09f5e742dfec3..8fec9f188bd09aa003326f2a84e8048ef9f76a4f 100644
--- a/posting/list.go
+++ b/posting/list.go
@@ -738,10 +738,7 @@ func (l *List) GetUids(offset, count int) []uint64 {
 		offset = 0
 	}
 
-	if count == 0 {
-		count = l.length() - offset
-
-	} else if count > l.length()-offset {
+	if count == 0 || count > l.length()-offset {
 		count = l.length() - offset
 	}
 	if count < 0 {