Since the error is being generated here
16 float temp = float(list[1]);
Then the problem is not caused by the conversion of a String to a float it is because the array length is less than 2 i.e. 0 or 1. It can’t be 0 because the exception would have been thrown by line 15. The only way I can see that happening is if the String s does not contain a comma.
Please show an example of s that generates this exception and the output from print list otherwise we are all working in the dark and having to guess possible causes.