The M&P 15 does not allow the safety to be on once snapped on an empty chamber or empty shell.
You can however cock it without the magazine in place without one in the spout an place the safety on "Safe".