diff --git a/src/containers/sound-tab.jsx b/src/containers/sound-tab.jsx index 519de7688..f95f6f709 100644 --- a/src/containers/sound-tab.jsx +++ b/src/containers/sound-tab.jsx @@ -38,7 +38,7 @@ class SoundTab extends React.Component { const target = editingTarget && sprites[editingTarget] ? sprites[editingTarget] : stage; if (target && target.sounds && this.state.selectedSoundIndex > target.sounds.length - 1) { - this.setState({selectedSoundIndex: target.sounds.length - 1}); + this.setState({selectedSoundIndex: Math.max(target.sounds.length - 1, 0)}); } } @@ -106,7 +106,7 @@ class SoundTab extends React.Component { onDeleteClick={this.handleDeleteSound} onItemClick={this.handleSelectSound} > - {target.sounds ? ( + {target.sounds && target.sounds.length > 0 ? ( ) : null} {this.props.soundRecorderVisible ? (