Skip to content

Comment on Three Dead Protocolsparent

Comments

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#L...

Ah, and then it just silently throws an exc and never closes the connection. Nice.

Gracias Señor@!

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.