Yep, the common out of battery firing.
The M16 trigger will release the hammer before the bolt is completely closed. In the M16 this makes no difference as the firing pin is too short to reach the primer until the bolt rotates back into the bolt carrier and locks behind the lugs. On the M&P15-22, however, the cartridge is held against the face of the bolt during controlled feeding and if the hammer drops with the bolt partially open it can strike the firing pin which in turn strikes the cartridge rim. Bang!
Bottom line: Call or Email S&W and start looking for a shipping box. When the pre-paid label arrives stick it on the box, stick the rifle inside, and let FedEx take it to S&W. It will come back directly to you when repaired so use a return address where someone will be there to sign for it.
-- Chuck