HEAD backport: Added a line to check for empty records. The hope is that this fixes bug #733 (gage)
Changed paths: