error check for empty array