Fatal Error: Undefined offset 1

In some scenarios of bad or intermittent internet connectivity this will happen. 

I was unable to debug the code at a moment of time that caused the error in order to better understand the content of response. This at least seems a sufficient safety check to have in place.