according to me you are trying to accessing values from array which not exists..
you need to check whether or not there are values or not in the array details then only you need to do the remeaning logic..
i have tried an example..and its working....
static List<String> accounts = new List<String>();
string line = string.Empty;
line = "hello World";
string details = line.Split(' ');
if(details !=string.Empty && details !=string.Empty)
accounts.Add(details.Substring(0, 5) + &:& + details.Substring(0, 5));
check that whether array contains values for details and details and also whether details and details exists or not as well...