Bug: Check for empty results from database query.  Only attempt to
iterate through if number of entries is not zero.

Signed-off-by: Rion Parsons <rkparson@ucsc.edu>