Fix: Ensure empty arrays don't throw (fixes #1418)