This check isn't needed. I believe it's implied that filename must be a non-empty string.