Prevent crash when array object ends up nil

This would be due to another issue somewhere else, but let's at least
not crash hard.
Merge pull request #1 from jblebrun/fix-nil-crash

Prevent crash when array object ends up nil