Check for newlines before checking size

This will keep us from getting warnings about trying to stat a filename that
contains newlines

Change-Id: I64e783739269c3562dbe07677e873e4efca2180e