added nil-error protection after message sharing