Check filename empty before throwing error