Fixed various crashes when saving camera snapshots or other attachments