6 ms·
For zero-based arrays, which Ruby has, it looks like the random_index passed to the CSV array can exceed the array's bounds due to the '+1': random_index =
by molecule 11y ago
For zero-based arrays, which Ruby has, it looks like the random_index passed to the CSV array can exceed the array's bounds due to the '+1':
random_index = rand(quotes_array.length + 1)
@quote_body = quotes_array[random_index]["Quote"]
@quote_author = quotes_array[random_index]["Author"]
https://github.com/theaisforannie/qotd/blob/master/qotd.rb#L34-L36 https://github.com/theaisforannie/qotd/blob/master/qotd.rb#L...
- dilap 11y agoAh, and then it just silently throws an exc and never closes the connection. Nice. Gracias Señor@!