Correctly bounds-check attachment access.

  Because the counting starts from zero we need to test for
 `>= m_attachments.size` rather than just `> m_attachments.size()`.