Witam.
Piszę sobie prosty menedżer haseł. Niestety napotkałem na błąd, z którym nie mogę sobie poradzić. Pobieram dane z pliku, odkodowuje je a następnie zapisuję do listy stringów. Niestety gdy plik jest pusty dostaję błąd: Index was outside the bounds of the array.
Wie ktoś jak rozwiązać ten problem? Poniżej zamieszczam kod.

        public static List<string> DecryptTextFromFile(String FileName, byte[] Key, byte[] IV)
        {
            try
            {
                FileStream fStream = File.Open(FileName, FileMode.OpenOrCreate);
                Rijndael RijndaelAlg = Rijndael.Create();

                CryptoStream cStream = new CryptoStream(fStream, RijndaelAlg.CreateDecryptor(Key, IV), CryptoStreamMode.Read);

                StreamReader sReader = new StreamReader(cStream);
                List<string> value = new List<string>();
                try
                {
                    while (!sReader.EndOfStream)
                    {
                        value.Add(sReader.ReadLine());
                    }
                }
                catch (Exception e)
                {
                    MessageBox.Show(e.Message, "Błąd", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                finally
                {
                    sReader.Close();
                    cStream.Close();
                    fStream.Close();
                }
                return value;
            }
            catch (CryptographicException e)
            {
                MessageBox.Show(e.Message, "Błąd", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return null;
            }
            catch (UnauthorizedAccessException e)
            {
                MessageBox.Show(e.Message, "Błąd", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return null;
            }