Factorize fetch error check by testing size after the fetch loop

Suggested by:	jilles