copy the arrays so we're not making a mess

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
Michael Telatynski 2017-06-01 23:50:14 +01:00
parent 0f2c89d525
commit beedeec163

View file

@ -956,7 +956,7 @@ module.exports = React.createClass({
label: _t('Default Device'), label: _t('Default Device'),
}; };
const audioInputs = this.state.mediaDevices.audioinput; const audioInputs = this.state.mediaDevices.audioinput.slice(0);
if (audioInputs.length > 0) { if (audioInputs.length > 0) {
if (!audioInputs.some((input) => input.deviceId === 'default')) { if (!audioInputs.some((input) => input.deviceId === 'default')) {
audioInputs.unshift(defaultOption); audioInputs.unshift(defaultOption);
@ -972,7 +972,7 @@ module.exports = React.createClass({
</div>; </div>;
} }
const videoInputs = this.state.mediaDevices.videoinput; const videoInputs = this.state.mediaDevices.videoinput.slice(0);
if (videoInputs.length > 0) { if (videoInputs.length > 0) {
if (!videoInputs.some((input) => input.deviceId === 'default')) { if (!videoInputs.some((input) => input.deviceId === 'default')) {
videoInputs.unshift(defaultOption); videoInputs.unshift(defaultOption);